BookmarkSubscribeRSS Feed
jaiganesh
Obsidian | Level 7

Hello, 

 

 

I've below set of code to be execute.

 

Data Test;

set mock;

if count eq 0 then ---> it should go the list line of the program i,e line no 45. All middle line of codes should not be read neither execute.

 

Is there any way to jump directly from one line of Code to other line of Code (irrespective of any data steps) ?

 

I believe , SAS may not allow this , Any suggestion would be appreciated on this.

 

3 REPLIES 3
Astounding
PROC Star

You cannot do this with line numbers.

 

If you define a macro, and if you add labels at various points, you can use %GOTO to move to the position where that label occurs.  See:

 

http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000206879.htm

 

Reeza
Super User
Depending on the code needed to run you could choose to use either macros or CALL EXECUTE or %INCLUDE to execute select statements. There's also the DO/END option within a data step.
ballardw
Super User

@jaiganesh wrote:

Hello, 

 

 

I've below set of code to be execute.

 

Data Test;

set mock;

if count eq 0 then ---> it should go the list line of the program i,e line no 45. All middle line of codes should not be read neither execute.

 

Is there any way to jump directly from one line of Code to other line of Code (irrespective of any data steps) ?

 

I believe , SAS may not allow this , Any suggestion would be appreciated on this.

 


Maybe show an entire data step with the conditions needed.

 

SAS data step has several ways to execute (or not) code: do/ end, If/then/else, Select, GO TO (or GOTO ) Label; Link,

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 609 views
  • 2 likes
  • 4 in conversation