|
data a;
input unid $ x y;
cards;
a 100 10
a 300 15
b 270 9
b 210 7
c 840 20
;
run;
%macro ab;
proc sql;
create table b as
select *,
%if unid='a' %then %do; (x/y)*1.2 as z format=8.2 %end;
%else %if unid='b' %then %do; (x/y)*1.5 as z format=8.2 %end;
%else %if unid='c' %then %do; (x/y)*2 as z format=8.2 %end;
from a;
quit;
%mend;
%ab
the code above is trying to calculate z=x/y with a adjustment(if unid=a then multiple by 1.2; if b then 1.5; if c then 2), but did not work.
so, just wonder anyone can help, thanks a lot!
|
|