SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
don21
Quartz | Level 8

Dear all,

 

I am facing lot of trouble currently with the below situation that I am in. Request your help/ideas in solving this:

 

I have recently finished a project for which the requirement was:

 

There were so many raw sources for a report (soo many, trust me). I need to import them all in sas, do the calc and then export them into excel using ODS into the exact same format as the existing manual excel report they have been currently using. The current manual report consists of YTD data, Jan till date, they add numbers everymonth.

 

But my SAS report consists of only one month data as we did it as a testing phase and was almost successful.

Now, the challenge is that I need to do the same for all the other months and bring out the actual complete report. but my code is written to accommodate only one month data at a time. the imnport part I have done in EG without hardcoding, so if I need to import another month I have to change the month name and  data set names in the code and run the entire process flow. Also I need to include the appned queries and append the data sets to the first created dataset each time I import a new month data.

 

I find this really complex because, even if I manage to do this for now, when I handover this code, the others should be able to handle and mantain it.

 

Request you to kindly suggest some good ideas to deal with the sitiation..

 

Many Thanks..

 

2 REPLIES 2
Kurt_Bremser
Super User

If you have already arrived at a stage where you only have to set a macro variable once and the code works on its own, then you just need to wrap your code into a macro that has the month macro variable as a parameter.

After that, you can call the macro repeatedly with call execute() off a dataset of months.

Reeza
Super User

You need to redesign your process so your data import and reporting are separated. So you first import and append your data in one step or process flow and then use a second to create the reports. This way the second, just uses the output from the first step of importing. 

 

Given what you've said it's harder to provide any further advice because it's a relatively vague question. But in general if you know you're going to have to automate a process it should be designed with some of those considerations in mind but that comes with time as well. 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 899 views
  • 0 likes
  • 3 in conversation