Hi All,
My Manager is a layman and don't have any SAS/programming knowledge. So far I had been giving him report by running my code in SAS editor window and exporting data to excel. Now he want to run my code in my absense, Can you guys tell me which module of SAS 9.4 should I use so that he can run my code in easy and user friendly way.
Thanks.
Are you manually exporting your data? Otherwise just setting up a macro that takes a date or file path and executes code should be enough. Other solutions will take a lot more time investment.
%let file_path=path to output excel.xlsx;
%include 'program to run.sas';
* A user interface to run SAS reports
HAVE
tax_100Rgn.sas
tax_110Fip.sas
WANT
A user interface with he option of running these
programs
SOLUTION
proc pmenu catalog=sasuser.pmenu;
menu main;
item 'file' menu=file;
item 'smg' menu=smg;
menu smg;
item 'US Tax by Region' selection=tax_100Rgn;
item 'US Tax by State' selection=tax_110Fip;
selection smg50 "end;'%%include tax_100Rgn.sas;' submit;";
selection smg55 "end;'%%include tax_110Fip.sas;' submit;";
menu file;
item 'End';
;run;
%window observe menu=sasuser.pmenu.main columns=65
#5 @18 'Chose Tax by Geography';
#6 @18 'See options on top menu bar';
%display observe;
;run;quit;
* much more elaborate 'dashboards' with
radioboxes, checkboxes, buttons can be easily created.
* This is a very minimal solution for your manager to
run one of two programs.
* just drag the SAS pmenu program onto
his desktop and he/she can click on it.
* use file on the toolbar to exit
More detail on a simple user interface to run reports
Basically, the programmer hits a function key and bunch of
Linked menus allow the programmer to select a report to run.
see
https://www.yammer.com/hhs.gov/#/files/62274071
HAVE (Two programs)
tax_100Rgn.sas
tax_110Fip.sas
* create 1st programs;
data _null_;
file "c:\temp\tax_100Rgn.sas";
input;
put _infile_;
cards4;
proc printto print="c:\temp\tax_100rgn.lst"
log="c:\temp\tax_100rgn.log" ;
run;
proc print data=sashelp.class(where=(sex='M'));
Title "Tax by Region";
proc printto;run;
run;
;;;;
run;quit;
* create 2nd programs;
data _null_;
file "c:\temp\tax_110Fip.sas";
input;
put _infile_;
cards4;
proc printto print="c:\temp\tax_100rgn.lst"
log="c:\temp\tax_100rgn.log" ;
proc print data=sashelp.class(where=(sex='F'));
run;
proc printto;run;
;;;;
run;quit;
WANT
A user interface with he option of runing these
programs
When the function key 'cntl Q; is pressed
Assignment
cntl Q home;inc c:\temp\utl_simpleui_dvr.sas;home;submit;
A new toolbar with two pull down menus and a window with this text
-----------------
| file tax |
|________________|
Choose Tax Report for Regions and States
See options on top menu bar
when you click on tax you get a submenu
Tax by Region
Tax by State
If you click on Tax by region the following
report is written to c:\temp\tax_100rgn.lst
Tax by Region
Obs NAME SEX AGE HEIGHT WEIGHT
1 Alfred M 14 69.0 112.5
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
15 Philip M 16 72.0 150.0
16 Robert M 12 64.8 128.0
17 Ronald M 15 67.0 133.0
18 Thomas M 11 57.5 85.0
19 William M 15 66.5 112.0
SOLUTION
* compile this once;
proc pmenu catalog=sasuser.pmenu;
menu main;
item 'file' menu=file;
item 'tax' menu=tax;
menu tax;
item 'Tax by Region' selection=tax100;
item 'Tax by State' selection=tax110;
selection tax100 "end;pgm;include c:\temp\tax_100rgn.sas; submit;";
selection tax110 "end;pgm;include c:\temp\tax_110fip.sas; submit;";
menu file;
item 'End';
run;
* save this driver save in c:/temp/utl_simpleui_dvr.sas;
data _null_;
window observe menu=sasuser.pmenu.main columns=65
#5 @18 'Choose Tax Report for Regions and States'
#6 @18 'See options on top menu bar';
display observe;
run;
assigb function key cntl Q
cntl Q -> home;inc c:\temp\utl_simpleui_dvr.sas;home;submit;
Note you can do this with a desktop icon
or a command ( tricky because pmenu has to be turned off;
I like enterprise guide for this purpose. Create a single process flow that has everything set up in it; then add prompt(s) for anything that needs to change. Include the output-to-excel in it, if you like (or just have him look at the open datasets). That way he can just push a button to run it - or you can even schedule it to run in his absence, that's very easy.
Scheduling would work well for a base SAS process also - create a .bat file to run the program in SAS and put it in the task scheduler on your desktop and then leave it on while you're away (or, better, put it on your server).
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.