Hi all,
I am trying to create a Web Stored Process that uses a single sourcefile to create different reports.
I would imagine I'd need different Macros for each datastep, like below.
libname sourcefile 'SingleSourceFile';
run;
data &one;
set sourcefile;
where b=1;
run;
data &two;
set sourcefile;
where b=2;
run;
data &three;
set sourcefile;
where b=3;
run;
The Stored Process will ask user to select report to run and point and run a datastep based on what the Macro Varible.
If possible, can someone point me to any resouce that I can use to create this solution.
Thanks for your help all.
Ruzvmun
You might want to use a macro statement that checks what the user want and then select which report to create?!
Lets say you have a prompt called reportSelection and it contains two reports -R1 and R2.
As an example STP code could look something like:
%macro select_report();
%if &reportSelection = R1 %then %do;
data out;
set sourcefile;
where b = 1;
run;
proc tabulate data=out;
......
.....
run;
%end;
%if &reportSelection = R2 %then %do;
data out;
set sourcefile;
where b = 2;
run;
proc print data=out;
run;
%end;
%mend;
%select_report;
Two different data selections and different outputs 🙂
//fredrik
I don't understand the question. If you want a single program to generate multiple reports why not just code the program to generate multiple reports?
Are you asking how to make the program conditionally generate only some of the reports based on the user's choice?
Hi Tom,
Yes...based on prompt user selects, run specific data step and leave out the rest. Does that make sense.
I apologize for the confustion, still a SAS novice.
You might want to use a macro statement that checks what the user want and then select which report to create?!
Lets say you have a prompt called reportSelection and it contains two reports -R1 and R2.
As an example STP code could look something like:
%macro select_report();
%if &reportSelection = R1 %then %do;
data out;
set sourcefile;
where b = 1;
run;
proc tabulate data=out;
......
.....
run;
%end;
%if &reportSelection = R2 %then %do;
data out;
set sourcefile;
where b = 2;
run;
proc print data=out;
run;
%end;
%mend;
%select_report;
Two different data selections and different outputs 🙂
//fredrik
Thank you Fred,
this worked and now I Boss is happy:)
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.