DATA Step, Macro, Functions and more

USER Prompt window using SAS in Unix

New Contributor
Posts: 2

USER Prompt window using SAS in Unix

Dear All,


I have a program some thing like below (and the file is added to a source control)


%let data = source.adsl;

%let var = age;

%let proc_to_run = mean;


%macro procs();
%if &proc_to_run eq mean %then %do;
    proc means data = &data;var &var;run;
%else %if &proc_to_run eq freq %then %do;
proc freq data = a;table &var;run;
%else %put selected procedure is invalid;


To, change the parameter values I need to check out and check in the program every time.

To avoid that, i taught to enter the values during the execution time by prompting a window with three parameters.

One for input dataset, second is for analysis variable and third is for procedure to execute (by listing the available procedures).


I found the below code on net, 

** This code is for the SAS windowing environment only. **/

/** %WINDOW defines the prompt **/
%window info
  #5 @5 'Please enter userid:'
  #5 @26 id 8 attr=underline
  #7 @5 'Please enter password:'
  #7 @28 pass 8 attr=underline display=no;

/** %DISPLAY invokes the prompt **/
%display info;

%put userid entered was &id;
%put password entered was &pass;

Which is suitable for windows environment. Is there anyway to achieve the same in UNIX environment ?





Super User
Super User
Posts: 7,933

Re: USER Prompt window using SAS in Unix

Did you try it?  It has always worked for me.

Make sure that you are using X-windows and not just dumb terminal.

New Contributor
Posts: 2

Re: USER Prompt window using SAS in Unix

Hi Tom,

I tried but that is not working when I run on unix server.

Can you provide some more details about the x-windows and how you have achieved...

Thanks in Advance,


Super User
Super User
Posts: 7,933

Re: USER Prompt window using SAS in Unix

How are you starting SAS.  Normally I open a X terminal window on the UNIX server (running sas xterm, dtterm, etc).

When you do that you should have an environment variable named DISPLAY that should look something like hostname:n where hostname is the name of the host where your X Windows Server software is running and the number after the colon is which screen on that X windows server your terminal is running.  Then to run SAS interactively you just type the command sas at the command prompt.


If instead you just have a X windows server running, but you are not running a X windows compatible terminal window then you might need to add the -display option to the command line to tell SAS what X windows screen to open the interactive SAS windows.

Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation