From: Aj on
Hi

I am using a %if condition to test a condtion in a macro . If the
condition is true I run a proc sql statement with WHERE clause inside
thte %if statement.

Surprising I get a ERROR message for the first pass "ERROR 180-322:
Statement is not valid or it is used out of proper order." and the
WHERE statement and create statement are underlined....

The structure loks like

%macro abcd(v,t,c,e);

%if ( "&t." = "D" ) %then %do;

%do i = &min. %to &max. ;
proc surveyselect data = xxxxxxxxx method = SRS rep = 1
sampsize = 1 seed = -1 out = A ;
id _all_;
where val = 10 and val 2 =2;
run;
quit;

%end;

%end;
%else;
%do;

proc surveyselect data = yyyyyyyyyyyyy method = SRS rep = 1
sampsize = 1 seed = -1 out = qwert. ;

where val = 10 and val 2 =2 and val3 = 45;
%end;






%mend;
%abcd(v,t,c,e);