I have a process flow which includes a program that uses PROC SQL to join a dataset to an offset of a copy of itself and fill in some additional data. I am supposed to re-run this program until there are no differences between the dataset and its copy (currently, I refresh the query output several times, then look at the proc compare output from a different program, then click refresh on the iterative query a bunch more times, check proc compare again, etc.). As such there is no negative impact on the dataset from running the programs more times than necessary.
I would like to be able to run the process flow in a certain order, in the middle of which run my iterative query some large number of times (by construction it shouldn't take more than 35-50). I tried using an ordered list, but it seemed like I was not able to add the same query more than once to the ordered list.
Is there any tool in EG to do what I have described? Or something I can add to the program (which consists solely of a PROC SQL) to make the program perform the iteration 50 times?
Hi,
Perhaps provide some test data and what you want out at the end. At a guess, if what you want is a file to look like another, then use that as a template and work backwards rather than trying to loop over to get to it, reason being you then have a finite point to work for back to base, whereas the way your are doing it is: keep doing this until some criteria is met.
It sounds like you need a macro program with ordered steps. The macro program would simply start by executing you compare. If differences exist and you need run the remaining program, then the macro should execute the remaining steps. Otherwise it should stop and perhaps display a message that there are no more iterations.
I have written a utility to run a program multiple times.
Routine CxInclude - sasCommunity
You will need to create a control data set with the parameters of the program.
Since you want to exit the loop on some condition
you'll have to add bypass logic inside the program being called.
%sysfunc(ifc(...))
is the trick
Using Functions SYSFUNC and IFC to conditionally execute statements in open code - sasCommunity
Ron Fehd %include maven
... or you can put your program in a macro
and use this utility to run the loop
Ron Fehd macro maven
see also
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.