Interactive screens to enter parameters

Reply
Contributor
Posts: 56

Interactive screens to enter parameters

Can you please anyone help me to create the Interactive screens to enter parameters in sas 9.2, through this I have to execute the macro program.

Regards

Shiva

Super Contributor
Posts: 644

Re: Interactive screens to enter parameters

@shivakrishna   

If you have SAS Enterprise Guide on your PC it is possible to enter parameters which are effectively macro variables for your process.

If you have SAS on your PC then you can use the macro statement %Window to create an additional window for entering parameter values.  You might find it easier to use the equivalent Window statement in a data _NULL_ statement with CALL SYMPUTX () to convert values to macro variables.  The syntax for both statements is very similar.

Here is the reference for %WINDOW (unchanged from earlier versions, I believe)

SAS(R) 9.3 Macro Language: Reference

It has the following example which you might be able to modify to suit your purpose

%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 info;

%put userid entered was &id;

%put password entered was &pass; 

Richard

Contributor
Posts: 56

Re: Interactive screens to enter parameters

Can you please help me to how to assign the parameters as for example

%macro(dsname=, outname=,var=)

data &dsname;

set sashelp.class;

run;

proc sort data =&dsname out=&outname;

by &var;

run;

%mend;

%macro(dsname=a,outname=b,var=age);

i have to give the parameters (dsname=a,outname=b,var=age) through the interactive screen.

thanks in advance

regards

Shiva

Super Contributor
Posts: 644

Re: Interactive screens to enter parameters

If you are using %Window for your parameter entry that is all the "macro" you need.  It should go something like this, but you might have to edit the %window code (dimensions) to allow 3 lines to show

%window params

#5 @5 'Please enter dsname:'

#5 @26 dsname 48 ;

#6 @5 'Please enter outname:'

#6 @28 outname 48 ;

#7 @5 'Please enter var:'

#7 @28 var 32 ;

%display params;

data &dsname;

set sashelp.class;

run;

proc sort data =&dsname out=&outname;

by &var;

run;

You don't need to wrap your data and proc steps in another macro.

Richard

Ask a Question
Discussion stats
  • 3 replies
  • 215 views
  • 1 like
  • 2 in conversation