BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cosmid
Lapis Lazuli | Level 10

Hi Tom, the SAS in Windows, I just click on the SAS 9.4 (English) at the Start Menu and it'll open up SAS Windows. And in UNIX, I just type in sas & to start SAS there and it will load about 4 to 5 separate windows, for log, editor, etc.

Tom
Super User Tom
Super User

@cosmid wrote:

Hi Tom, the SAS in Windows, I just click on the SAS 9.4 (English) at the Start Menu and it'll open up SAS Windows. And in UNIX, I just type in sas & to start SAS there and it will load about 4 to 5 separate windows, for log, editor, etc.


So look at the definition of the ICON you are clicking on to see where SAS lives on your computer and try typing that command from a command window.  THen you can see if it will also accept input from the terminal the way it did in Unix.

 

Since you appear to be using DISPLAY MANAGER in both cases you can use the %WINDOW statement to get your user input. Check out the second example in the documentation.  https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n0ojc9rtfrzvbdn16kqd2c5mzobq.htm

 

cosmid
Lapis Lazuli | Level 10

Great, it worked!

ballardw
Super User

First let's see if I understand what you want to happen.

I am guessing that you want users to enter something, then display it back or use that entered value in a program.

 

In the Display Manager interactive sessions you would use the %window (for macro) to define a window for users to enter text into and then the %display command to activate the window.

 

Example

%macro Nameentry;
%window Name
  #5 @5 'Please enter name:'
  #5 @26 name 8 attr=underline
;
%display name;

%put Name entered was &name.;
%mend;

%Nameentry

The %window statement is a single statement with a number of options such as color and such. After keyword %window is the Name of the window, in this case Name. The #5 @5 display something at line 5 column 5 inside the window. The first displays the text indicating what to enter. Then at column 26 the text entry area starts, the 8 allows 8 characters and the attr=underline shows a line in the window for the text entry.

Note that the line contents do not end with a semicolon. The whole %window is a single statement with a single semicolon ending the whole thing.

 

The %display command uses the name of the window to display.

 

When you enter the text and press the enter key the window closes and the %put displays the value entered.

You can have multiple rows of displayed text (instructions or example perhaps) and multiple entry areas each with the name of a different macro variable.

 

This should work on Windows, Unix or other interactive systems

Documentation at: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/mcrolref/n0ojc9rtfrzvbdn16kqd2c5mzobq.htm for options that control the appearance of the window.

 

There is also a data step equivalent.

cosmid
Lapis Lazuli | Level 10

Hi ballardw, thank you so much for that information! It explained the document better and gave me a better understanding. Tom posted the doc just a few mins before this one so I have accepted that as the solution. It would be nice if I can accept both. Thanks again for your help!

ballardw
Super User

@cosmid wrote:

Hi ballardw, thank you so much for that information! It explained the document better and gave me a better understanding. Tom posted the doc just a few mins before this one so I have accepted that as the solution. It would be nice if I can accept both. Thanks again for your help!


No problem with who gets credit as long as you get a workable solution.

 

I will say that it has been more than 20 years since the last time I actually used the %Window though.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 20 replies
  • 1133 views
  • 9 likes
  • 5 in conversation