BookmarkSubscribeRSS Feed
venkibhu
Calcite | Level 5

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;
%end;
%else %if &proc_to_run eq freq %then %do;
proc freq data = a;table &var;run;
%end;
%else %put selected procedure is invalid;
%mend;
%procs;

 

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 ?

 

Thanks,

 

Venkat.

3 REPLIES 3
Tom
Super User Tom
Super User

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

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

venkibhu
Calcite | Level 5

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,

Venkat. 

Tom
Super User Tom
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 992 views
  • 0 likes
  • 2 in conversation