SAS Display Manager commands
Asked Answered
C

9

14

The SAS display manager is a comamnd line interface to the SAS system, which remains in Base SAS as a legacy facility.

However the online documentation on how to use this facility is sparse at best, and google searches are less than fruitful.

A common DM command would be: CLEAR LOG; CLEAR OUTPUT; WPGM;

My question is - What other DM commands are out there?

Caliber answered 5/8, 2009 at 12:52 Comment(0)
L
5

Unfortunately, it doesn't seem like SAS has its commands listed in a single place online. All commands are documented within SAS, however.

1. Enter help into the command line

enter image description here

2. Search for the exact phrase "Overview of SAS Commands"

enter image description here

3. Select the link "SAS Commands by Category"

This brings up the following list:

enter image description here

All of the commands mentioned by other people are present in this list. The category which pertains to your question specifically is "Windowing Management."

4. Scroll down to the "Windowing Management" category

enter image description here

Lindyline answered 4/4, 2017 at 18:46 Comment(2)
Only took 8 years, but this is definitely the answer I was looking for!Caliber
A useful note is that there are two KEYS tables, one for the Display Manager and one for Viewtables. Typing the KEYS command from a Viewtable gives you a different menu than from any other window. It looks like these KEYS tables are stored in the Sasuser.Profile catalog and those are the only two such tables in there. From this I assume there aren't other KEYS tables.Lindyline
H
10

Here are some links that have a large number of commands:

FSP Commands
Commands specific to Windows
AF Windowing Commands
Commands for the Program Editor (Scroll down to second paragraph)

Hound answered 5/8, 2009 at 12:52 Comment(0)
I
8

I like to close all view tables at once:

%macro closevts / /* The cmd option makes the macro available to dms */ / cmd; 
  %local i; 
  %do i=1 %to 20;
    next "viewtable:"; end; 
  %end; 
%mend;

dm "keydef F12 '%NRSTR(%closevts);'";
Incise answered 15/7, 2010 at 8:59 Comment(1)
SAS beginner here... how would one simply call this from code, instead of assigning it to a function key?Rovit
C
5

Some examples I have found useful (in open code format) are:

dm "vt &syslast"; * open a dataset ;
dm "keydef F2 'next VIEWTABLE:; end'"; * close ViewTable windows (credit cmjohns) ;
dm "keydef F4 'viewtable &syslast view=form'"; * open table in form view ;
dm 'keydef f11 rsubmit'; * assigns the rsubmit command to the F11 key ;
dm "keydef F12 'cle log; cle output; submit'"; 
dm "next explorer; detail";  * applies detail view to explorer (credit to Liz);
dm "keydef F7 ""command focus;"""; * puts command bar in focus (credit to Trevor);
Caliber answered 5/8, 2009 at 12:54 Comment(0)
L
5

Unfortunately, it doesn't seem like SAS has its commands listed in a single place online. All commands are documented within SAS, however.

1. Enter help into the command line

enter image description here

2. Search for the exact phrase "Overview of SAS Commands"

enter image description here

3. Select the link "SAS Commands by Category"

This brings up the following list:

enter image description here

All of the commands mentioned by other people are present in this list. The category which pertains to your question specifically is "Windowing Management."

4. Scroll down to the "Windowing Management" category

enter image description here

Lindyline answered 4/4, 2017 at 18:46 Comment(2)
Only took 8 years, but this is definitely the answer I was looking for!Caliber
A useful note is that there are two KEYS tables, one for the Display Manager and one for Viewtables. Typing the KEYS command from a Viewtable gives you a different menu than from any other window. It looks like these KEYS tables are stored in the Sasuser.Profile catalog and those are the only two such tables in there. From this I assume there aren't other KEYS tables.Lindyline
O
4

A couple of shortcuts I use (in addition to the cle <windowname>

  • fsv <datasetname> (opens a dataset using FS View)
  • vt <datasetmae> (opens a dataset using View Table)
  • subtop <N# of line> (submits the top N lines from the program editor)

One other useful feature.. Use the display manager menus to do the task that you want the command for. Then switch the commandline on and issue the ? command or (if necessary) a series of ? commands. This will retrieve back to the commandline the last command executed (even if that command was executed by the Display Manager menu system).

By looking at the previous commands executed, you can find a number of relatively obscure commands. I believe that EVERY display manager menu has its commandline equivalent which you can then use.

Occident answered 5/8, 2009 at 13:39 Comment(1)
can you please expand on how the ? feature works? sounds very useful indeed!Caliber
P
2

I set CTRL+F3 to 'rsubmit' - saves typing rsubmit / endrsubmit when developing code to go into remote production.

Pedology answered 27/8, 2009 at 8:52 Comment(1)
I believe everyone who works in a complex system does something similar, regardless this is really great advice for someone who didnt know it :D +1Knobkerrie
T
1

The link that cmjohns posted giving a list of commands is GREAT!

Some Additional Info about these commands...
You can set these commands as shortcuts in the SAS Display Manager.
Open DMKEYS (should be F2, or enter command 'keys'). DMKEYS shows you all of your default shortcuts, but you can modify it as you like.

For example:
I like to set F12=log;clear;pgm;submit; (This would 'clear all' from the Log Window and submit code from Program Editor)
You can also make it more intuitive with copy/paste...
Ctrl C=store
Ctrl V=paste

Taut answered 7/8, 2009 at 17:21 Comment(0)
R
1

There is a SAS script I run often for quality assurance. Often enough that I wanted to assign it a shortcut key.

I now have the first command in the test macro below in my autoexec.sas. I left the entire macro to make it easier for you to adapt the script to your needs.

If you save the script as c:\tmp\testDMKEYS.sas, and run the first two commands in the macro (e.g., by selecting them and pressing F3), then when you press F12 the log message DM KEYDEF successful. will appear.

%macro rem/des='helper for debugging DM KEYDEF';
    /* This goes in your autoexec.sas: */
    dm 'keydef F12 %NRSTR(%inc %"&_my_favorite_program%";)';
    /* This too, although you can always change it later. */
    %let _my_favorite_program=c:/tmp/testDMKEYS.sas;

    /* Here are some useful debugging tools for quoting issues */
    data foo; bar=1; run;
    %inc "c:/tmp/testDMKEYS.sas";
    /* escape from SAS open block, a.k.a. quote killer
    %mend; quit; ;*';*";*/;
%mend;

%put DM KEYDEF successful.;

If you have any suggestions for simplifications please add them in the comments.

Regeneration answered 20/12, 2015 at 1:33 Comment(0)
C
0

Some commands which open other useful windows include:

• assist - menu driven version of SAS
• dir - shows data sets in a library
• var - shows variables in a data set
• notepad - simple text window
• options - view and change system options
• filename - view current filename assignments
• help - interactive help system
• libname - view current libname assignments

Some useful display manager commands which work in any window include:

• clear - clear the contents of the window
• end - close the window
• endsas - end the sas session
• file "filename" - save contents of the window to filename
• prevcmd - recall previous display manager command

(extract from http://www.stat.berkeley.edu/classes/s100/sas.pdf )

Caliber answered 29/8, 2010 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.