BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Srigyan
Quartz | Level 8

I am writing an automated SAS process where 

It checks teradata first and if the data is available in the table then only run the code in program otherwise it jump on a given location like in VBA.

if <condition>=true then do:

process:

else goto gg:



statement,,,

statement,,,

statement,,,

statement,,,statement,,,



gg:

code resume from here



do we have same thing in SAS...

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
Kurt_Bremser
Super User

Since 9.4M5 we can use %if in open code (outside a macro):

%let flag=0;

%if &flag %then %do;

proc print data=sashelp.class;
run;

%end;
Srigyan
Quartz | Level 8

My Current version: 9.04.01M3P062415.

Will it work here or do we have any other alternative

Kurt_Bremser
Super User

If %if %then %do does not work in open code, you need to pack all code you want to run conditionally into a macro, so you can use %if there.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 918 views
  • 0 likes
  • 2 in conversation