BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

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!

5 REPLIES 5
Astounding
PROC Star

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.

SASKiwi
PROC Star

Another way is to select the steps you want to run using your mouse and press F3 / F8 to run the selection.

LinusH
Tourmaline | Level 20
Why do you have code that you don't want to execute?
Are you executing interactively?
Consider splitting your program.
If you are an EG user there are means to group steps into different units, like a process flow.
Data never sleeps
sbxkoenk
SAS Super FREQ

If you use the SAS Windowing environment, you can use this command:

 

subtop 19 

 

(it will submit the top 19 lines of code)

 

Koen

ballardw
Super User

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.

 

 

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1388 views
  • 1 like
  • 6 in conversation