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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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