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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.