SAS 9.4
When current SAS code completes, the last window open, on top, is the "Results" window.
User wants SAS to return to the "Log" window, programmatically.
The answer, via searching, seems to be:
/* Command to switch to the Log window and maximize it */
dm 'log; wmaximize;';
Unfortunately, that doesn't seem to work. Seems to be entirely ignored. Top window continues to be "Results". Even though the above command does appear in the log window (when user manually returns there, by way of mouse click on log 'tab').
Suggestions greatly appreciated.
@NKormanik wrote:
I prefer to drag my SAS scripts from Windows Desktop (or Explorer) to the SAS Log window.
One after another.
That's why I would prefer PC SAS to end up with the Log window on top at the end of running a script. Just one less hassle.
So change your Preferences. Unclick this box in the Results panel.
Defining a function key that both runs the code, then goes to the LOG window works for me: submit;log
As @whymath wrote the DM statement works only in Display Manager environment, i.e., this one:
and as you can see in the help window, documentation confirms the fact.
If your code is executed in SAS Enterprise Guide, SAS Studio, or even Visual Studio Code with SAS extension, the DM wont do a thing, it will be ignored.
Bart
"DM statement works only in Display Manager environment..."
What we have to do, then, is define Display Manager environment.
Aren't all the SAS 9.4 'windows' included?
If we run a script in SAS 9.4, are we running that script in the DM environment?
There are three SAS-supplied development interfaces to SAS 9.4:
You can run SAS scripts in any of these interfaces and also from operating system command lines as a batch job.
DM statements (short for Display Manager) only work in the first interface, not the other two. I suggest you explore the above links to find out more about each interface.
Yep, SAS 9.4, what I said at the outset should work, but doesn't.
/* Command to switch to the Log window and maximize it */
dm 'log; wmaximize;';
Perhaps give it a try in some script. Put it at the end of the script.
The objective is to end up with the 'Log' window on top, maximized.
Maybe DM commands do not work from scripts?
The <DM> statement is IDE/GUI dependent.
If your program runs in Batch (hard to call it IDE, I know), SAS Enterprise Guide or SAS Studio the <DM> won't work.
If your program runs in SAS Windowing Environment (aka SAS Display Manager aka SASDM) then <DM> will work.
So unless the user/customer you're writing about works in SASDM then the <DM> statement won't help.
Bart
How are you running SAS? Which application do you open when you submit SAS code? Are you using SAS Enterprise Guide? Or SAS Studio? Or visual studio code (unlikely)? Or "PC SAS"?
If you don't know, can you post a screen shot of your SAS interface, as it looks when you are viewing the log, and include all of the menus and windows on the screen? If it looks like the picture that @yabwon posted, then DM commands should work.
I prefer to drag my SAS scripts from Windows Desktop (or Explorer) to the SAS Log window.
One after another.
That's why I would prefer PC SAS to end up with the Log window on top at the end of running a script. Just one less hassle.
@NKormanik wrote:
I prefer to drag my SAS scripts from Windows Desktop (or Explorer) to the SAS Log window.
One after another.
That's why I would prefer PC SAS to end up with the Log window on top at the end of running a script. Just one less hassle.
Ahh, I missed this post. I've been using PC SAS for 25 years. Never knew until today that if you drag a .sas file into the log window it submits the code. That's wild.
Or even a .txt file.
Easy peasy.
@NKormanik wrote:
I prefer to drag my SAS scripts from Windows Desktop (or Explorer) to the SAS Log window.
One after another.
That's why I would prefer PC SAS to end up with the Log window on top at the end of running a script. Just one less hassle.
So change your Preferences. Unclick this box in the Results panel.
@NKormanik - Looks like you haven't read my workaround above using a function key defined as submit;log. I tried it myself and it worked.
I did indeed. Works nicely. Thank you!
However, I'd still prefer PC SAS end up with the Log window top-most.
Such a simple request.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.