To add an update since this was answered in 2015, from SAS9.4M5 this can be done in open code. https://blogs.sas.com/content/sasdummy/2018/07/05/if-then-else-sas-programs/
%if not(%symexist(g900_r)) %then %do; %let g900_r=0; %end;