Hi:
%IF and macro conditional logic can only be used in a SAS Macro definition -- also sometimes called a SAS Macro program. A SAS Macro definition is like this:
[pre]
%macro mymacpgm(parm1=, parm2=);
....some code including %IF, %DO, etc other code, datastep code, proc code, etc....
%mend mymacpgm;
[/pre]
Now, to invoke the macro definition, you must do:
[pre]
%mymacpgm(parm1=wombat, parm2=koala)
[/pre]
This is a very good introduction to the Macro Facility, which will take you through the basics and explain why you can't use %IF in open code:
http://www2.sas.com/proceedings/sugi28/056-28.pdf
cynthia