Here is what I'm trying to accomplish (and this may be simple, so I apologize if I'm asking a basic question...please forgive me!)
SAS Program #1 - Program I am coding for a new, specific research project.
SAS Program #2 - Program code that I routinely run for all of my research projects.
Historically, I have run #1, dumped the working dataset out, switched over to #2, processed the data through #2, dumped it back out, and re-imported it back into #1. Is there a way I can code #1 so that it automatically loads in #2, runs the data inside of #1, and keeps right on going so that I do not have to manually stop #1, dump to #2, run #2, dump back to #1, import back into #1?
Example: Program #1
Variables: Date Assets Liabilities Equity Revenue Expenses
2005 $1,000 $500 $500 $1,000 $750
2006 $1,100 $600 $500 $1,500 $900
2007 $1,500 $800 $700 $2,000 $1,200
In Program #2, it is coded to calculate (just an example, obviously it's a much more lengthy/complicated code that I update all the time so I want the newest version of #2 to always run on any of my other projects) Net Income, as follows:
Net Income = Revenue - Expenses;
Once #2 calculates Net Income, it exports the data, then I re-import back to #1 and continue. I'd like to find a way to automate this. Any tips?
Thanks!!!
When it is just for calculating some value out of some other variables that there are many options.
1- build a macro library for including needed code modifications.
When going macrotized that can be build to an very advanced level
2- use the %include statement - %inc fileref(menber) ; - for bringing in building blocks of code.
Doing this the code blocks must be very standardized and simple. The technical solution is that simple
3- use FCMP or other precompiled function options.
It sounds like you need to make a macro . Check:
%do i=1 %to N ;
Program #1
Program #2
%end;
%do %while();
Program #1
Program #2
%end;
%do %until();
Program #1
Program #2
%end;
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.