Hi guys I really neeed help with this Macro! it seems like my If then statemet is not working properly: %macro exploredata (data); proc contents data = &data out = v (keep=type name); run; proc sql noprint; *where type = 1 specifies the numerical variable; select name into :m separated by ' ' from v where type = 1; Quit; proc means data = &data; var &m; output out = temp1 min=&m; run; proc means data=&data; var &m; output out = temp2 n =&m; run; proc means data =&data; var &m; output out=temp3 max =&M run; proc means data = &data; output out = temp4 mean=&m; run; proc means data =&data; output out = temp5 nmiss=&m; run; proc means data=&data; var &m; output out = temp6 median =&m; run; data tem_all; set temp1 temp2 temp3 temp4 temp5 temp6; run; proc transpose data = tem_all out=trans (rename = (COL1=min COL2 = nmiss COL3 = max COL4 = mean COL5=nomiss COL6= median)); var &m; run; Data temf; set trans; per_miss = nomiss/(nomiss+nmiss); ind_name = trim(_name_)||'_in'; ind_name = trim(_name_)||'_in'; medianstr = put(median,3.); run; data temf; set temf; %if per_miss > 0.50 %then %do; indicator = trim(ind_name)||'=('||trim(_name_)||'=.)'; run; %end; %else %if 0.10 <per_miss <= 0.50 %then %do; indicator = trim(ind_name)||'='||trim(medianstr); run; %end; %else %do; indicator = 'none'; run; %end; proc contents data = temf out = temf1(keep= name type ); run; data temf2; set temf1;set temf; drop name; run; proc sql; select indicator into :mv separated by ';' from temf2; quit; %mend exploredata; %exploredata(A);
... View more