BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fengyuwuzu
Pyrite | Level 9

I have a number of variables that were log transformed, and I wanted to use these new variables to do ANOVA.

I first created a macro variable to store all the log transformed variables names and then used a do loop to repeat the anova analysis.

The problem is, my last log variables was not included in the anova analysis. I checked the values of the macro variables "collist" and "n", which were both correct.

 

What could be the problem?

 

 


%macro loop_var(data);
proc contents data=&data short out=test; run;
proc sql;
select name into :collist separated by ' '
from test
where name like 'log_%';
%let n=&sqlobs;
quit;
ods graphics off;
%do i=1 %to &n;
    %let currentvar=%scan(&collist,&i);
proc glm data=&data ;
class type;
model &currentvar=type;
lsmeans type /pdiff stderr cl ADJUST=SCHEFFE;
%end;
%mend;

%loop_var(mydata);
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Try adding

run;

at the end of the Proc Glm code. You may not be running into a "boundary" to tell the procedure that the last one ended.

View solution in original post

3 REPLIES 3
Quentin
Super User

What values do you have for collist and n?

 

Perhaps add:

%put collist=&collist i=&i currentvar=&currentvar n=&n;

Immediately before your PROC GLM statement.  That should help debug.

 

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
ballardw
Super User

Try adding

run;

at the end of the Proc Glm code. You may not be running into a "boundary" to tell the procedure that the last one ended.

fengyuwuzu
Pyrite | Level 9

yes. this solved the problem. Thank you.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 850 views
  • 0 likes
  • 3 in conversation