BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Roger
Calcite | Level 5

Hi,

I have a Stored Process Report in Web Report Studio that creates a PDF report. The person who created this report doesn't work with us anymore. The Stored Process has a prompt parameter called Filter: Male, Female, Alabama, Alaska, Arizona, etc. (50 States). All of these values are listed under a "Filter" parameter. Currently, I can select only one value and create a report in WRS. I need to select Male + Female + 50 States and create a PDF report.

Could someone help me to create a report for each of 50 states in batch? I was reading "Processing Reports Outside of SAS Web Report Studio" in SAS Knowledge Base, but can't figure out how to include parameters/stored process.

Thanks!

RS

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Since a stored process is already controlled by macro variables (the prompts end up as such), you have to wrap the code into %macro something(); and %mend; insert a list of the prompt macro variables (without leading &) between the parentheses of the %macro statement.

If you want to repeatedly execute the macro from a data step, here's an example at the bottom of the page:

SAS(R) 9.2 Macro Language: Reference

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

Depending on your environment, I suggest

- wrap the SAS code into a macro and then execute the macro for each parameter combination (you can do this in a data step, see "call execute")

- put the sas code into a .sas file, get male/female and state in the code from the OS environment (%sysget) and then write a wrapper script (UNIX: for STATE in AL ...;do;for GEN in M F; do; export STATE;export GEN;sas program.sas;done;done) to repeatedly run the code

Roger
Calcite | Level 5

Thanks Kurt for your input! It's Windows environment. I was trying to use "call execute" as you suggested, but I'm not sure how to include the Stored Process. It takes a lot of time and effort to run same report 50 times every day. Is there an easy way I can run it using a macro?

-RS

Kurt_Bremser
Super User

Since a stored process is already controlled by macro variables (the prompts end up as such), you have to wrap the code into %macro something(); and %mend; insert a list of the prompt macro variables (without leading &) between the parentheses of the %macro statement.

If you want to repeatedly execute the macro from a data step, here's an example at the bottom of the page:

SAS(R) 9.2 Macro Language: Reference

Roger
Calcite | Level 5

Thank you, Kurt! I really appreciate your help. -RS

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 2092 views
  • 3 likes
  • 2 in conversation