December 7, 2005 at 8:19 pm #1649ketivarParticipant
I posted this in the “User Macro” forum but thought I’d get some more exposure in here:
“I use ME to run SAS. When I execute a SAS program, it creates a log file and an output file, both are just plain text. I created a macro that determines if the log and list files are open in multi edit, if they are, it will re-load them. If they aren’t open, the macro searches the working directory for them, if they’re found, new windows are created then the files are loaded. I assigned this macro to a hot key (F11) and it works great.
So after I run a program, I can load my new log and output files at the touch of a button. However, I run this macro after every execution and it would be even nicer if I could get it to run automatically.
Right now I have ME configured so I can hit one key to comiple my SAS programs, then I wait for execution then I hit another key to run my macro.
I’d like to get it so I just have to hit one hot key that executes my programs (no compiler chioce menu) and then automatically calls my macro which loads the new log and output.
I’m new to the CMAC comipler but I’m sure there’s a way to combine these functions. Any suggestions for me?”
I use command line to execute SAS.
My hot key is mapped to “Command Line”:
“c:\path\sas.exe” -sysin “<FILE>”
I assume this could be worked into the macro somehow but I’d have to add code to the macro that would wait for the execution to finish prior to checking for the updated output files.December 8, 2005 at 1:26 pm #5962BrentStrohParticipant
It’s been a while since I’ve even gotten to use MEW, let alone do anything interesting with it, but there is such a thing as a post-compile macro. It may do what you’re looking for.
Tools|Customize|FileName Extensions|(Pick one)|Edit
Then, from the extension definition:
Compiler/Program Setup|(Pick one)|Edit|Program Type ellipsis
(Pick one)|Edit, and fill in the name of your post-compile macro. Don’t forget the filename in the format – filename^macroname – because your macro probably won’t normally be in memory unless you’ve manually compiled it during the current session.
There’s at least one quicker path to get there, but it depends on a couple of your settings. This path, while not as convenient, will work regardless.December 8, 2005 at 9:19 pm #5964ketivarParticipant
Thanks for the suggestion Brent. I wasn’t able to get that method working but it gave me an idea so I played around some more and I was able to come up with a solution.
I created a compiler type for SAS in the Compiler/Program Setup so I could use a function from Compile.s. Then I added a call to the CompileBtnEx function at the top of my macro.
Now I just need to call the macro and it automatically compiles my program and then loads (or refreshes) my output files.
- You must be logged in to reply to this topic.