When to use %IF and %DO compare to IF and DO in SAS?

if
sas
do

#1

Hi,

I am new to SAS macro and want to figure out when to use %if and %do compare to if and do. Can you help me to know the differences between these two methods. Any help is appreciated.

Thanks


#2

@Rajiv_deshmukh

The major difference between the two is %if-%Do can only be used inside the MACRO program (whether it is inside the DATA step or outside) and if-Do can be used only inside the DATA step (whether MACRO or non-MACRO statements).

You can also refer below link to understand more about it:-

Regards,
Sunil