Traditional web-based reporting with SAS BI tools

How to Run a Report in Batch?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

How to Run a Report in Batch?

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


Accepted Solutions
Solution
‎03-27-2014 02:17 AM
Esteemed Advisor
Posts: 6,685

Re: How to Run a Report in Batch?

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

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Esteemed Advisor
Posts: 6,685

Re: How to Run a Report in Batch?

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

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 16

Re: How to Run a Report in Batch?

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

Solution
‎03-27-2014 02:17 AM
Esteemed Advisor
Posts: 6,685

Re: How to Run a Report in Batch?

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

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 16

Re: How to Run a Report in Batch?

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 1132 views
  • 3 likes
  • 2 in conversation