Hi,
I need to Create quarterly report without changing automated code created for monthly report
Present code as follows:
%let dt1 = '2014-01-01' /* start date for month*/
%let dt2 = '2014-01-30' /* end date for month */
followed by the automated code that creates dataset for this particular month mentioned in dt1 and dt2
when i run the above code it will create report for month Jan 2014. What if i want to create for Jan Feb and march 2014 different datasets and then combine them to create quarterly report.
Could anyone help me with this.
Is there a way i can run for 3 different months either by creating loop or macro and running the automated monthly code without making any changes. and create 3 different dataset and merge results of all three dataset and create quarterly report?
Any help would be appreciated.
Why separate them into different tables? Just keep them together with the date, and summarize on appropriate level in the report.
The code is created in such a way that final datasets could be created only for a month.
Even for getting 3 months report I cannot change end date to march 2014.
%let dt1 = '2014-01-01' /* start date for month*/
%let dt2 = '2014-03-31' /* end date for month */
And they do not want me to make any changes in this code created by someone else.
So only solution i thought was creating code that will run this code 3 times for 3 different months and then i can combine all datasets into 1 to create quarterly report.
But do not know how to go about.
Any other suggestions appreciated
1. Remove the macro declarations from the program
2. Change the final output data set to have a unique name per run, perhaps set by another macro variable.
3. Create a master program that sets the macro variable and then includes the old program
4. Call it 3 times
5. Write your code to combine the 3 output datasets together.
Master program would look something like this:
*First month;
%let dt1 = '2014-01-01' /* start date for month*/
%let dt2 = '2014-01-30' /* end date for month */
%let output=January;
%include 'original code.sas';
...
*Third month;
%let dt1 = '2014-03-01' /* start date for month*/
%let dt2 = '2014-03-31' /* end date for month */
%let output=March;
%include 'original code.sas';
*Rest of SAS code to merge/append code as required.
Good Luck!
Thank you Reeza. Hope that works. I just tried before but there were some issues coming about but will look into it.
Sometimes it just happens you know what to use but do not know how to use them and when to use them.
Thank you so much for giving me a start. Appreciated!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.