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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.