Hi all, I am trying to write a macro where the first step creates some stats from a t-test, then I do some additional work on the ods output and refer to it by the macro deined "%let" name. I keep getting a "Error 180-322: Statement is not valid or it is used out of proper order" with by step statement in a data step. I'm at a loss. Below is a snippet of the macro: %macro m1 (varlist); %local i next ; %let i=1; %do i=1 %to %sysfunc(countw(&varlist)); %let next=%scan(&varlist,&i); * Step 1; %let lib1 = work; %let lib2 = work; %let fileorg = survey_of_interest; %let pre = &next; %let survey = "&next"; DATA survey_of_interest; SET data_raw_2; WHERE survey_name = &survey; RUN; ods output "Statistics" = &pre.stats "T-Tests" = &pre.ttests "Equality of Variances" = &pre.vars; proc ttest data=&lib2..&fileorg; class finaid; *by survey_name; var _numeric_; run; ods output close; *Step 2; *%let lib1 = work; *%let pre = finaid_css; data &pre.stats1 (keep = survey_name variable class mean_nonfinaid mean_finaid pooled_sd); set work.&&pre.stats (rename=(mean=avg)); %if class = '0' %then mean_nonfinaid = avg; %if class = '1' %then mean_finaid = avg; %if class = 'Diff (1-2)' %then pooled_sd = StdDev; run; %end; %mend m1; %m1(CSS); I seem to have all the semicolons, but I don't know what is happening.
... View more