Hello everyone,
I have a 1000 rows of SAS code they are around 30 data steps. if I want the SAS code stop executing only after first 10 data steps finish running. how to do that? I don't want to use 'endsas' command.
Thanks!
One common method is to define the steps that you don't want to run as being a macro. For example, after the 10 steps that you want to run, insert this line of code:
%macro SkipThis;
Then at the end of the program insert this line:
%mend SkipThis;
That will define the 20 steps that you want to skip as the contents of a macro, but the program never executes the macro so the steps never run.
Another way is to select the steps you want to run using your mouse and press F3 / F8 to run the selection.
If you use the SAS Windowing environment, you can use this command:
subtop 19
(it will submit the top 19 lines of code)
Koen
Yet another way COMMENTs and %include.
Put the code that you don't want to run into a separate program file. Then put an %include statement within comments so that it doesn't run.
<code>
/* comment not to run this
%include "path/myothercode.sas";
end comment */
When you want to run the code in the %include the Highlight that line and submit it. But if the whole program file is run the bit in the %include won't run.
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 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.