BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
venkkat
Fluorite | Level 6
%MACRO BLUE_SG_da (trait);
 PROC MIXED DATA=WORK.bo cl=wald covtest;
 CLASS ID BLOCK EVR ;
 MODEL &TRAIT=ID/s;
 Random  EVR EVR*ID BLOCK(EVR);
 LSMEANS ID; 
 ODS output lsmeans=BLUE_SG_&trait;
 run;
 quit;
 %mend BLUE_SG_da;
 %BLUE_SG_da (trait= DRYWT_PL);
 %BLUE_SG_da (trait= PROP_DRY_WT);
 run;
 %macro data(trait=);
 data BLUE_SG_&trait; set BLUE_SG_&trait; &trait=estimate; keep ID &trait;
 run;
 %mend data;
 %data(trait=DRYWT_PL);
 %data(trait=PROP_DRY_WT);
  run;
 data BLUE_SG_total; merge BLUE_SG_DRYWT_PL BLUE_SG_PROP_DRY_WT;  by ID; 
 run;

I. have tried to generate ls means.  with the above script 

I am facing with the following error

 

WARNING: Output 'lsmeans' was not created. Make sure that the output object name, label, or path is spelled correctly. Also,
verify that the appropriate procedure options are used to produce the requested output object. For example, verify that
the NOPRINT option is not used.
1 ACCEPTED SOLUTION

Accepted Solutions
STAT_Kathleen
SAS Employee
Also check that your PROC MIXED model converges. If the model fails to converge the ODS OUTPUT LSMEANS= data set would not be created.

View solution in original post

8 REPLIES 8
Rick_SAS
SAS Super FREQ

The way to debug code like this is to isolate the code that is giving the problem and remove it from the macro, if possible. Your code seems to work on the following simulated data, so perhaps there is something unusual about your data? Run the PROC MIXED against your actual data and examine the log.

 

%let trait=DRYWT_PL;
data bo_fake;
call streaminit(1);
do n = 1 to 20;
do ID = 0 to 1;
  do block=0 to 2;
     do evr=0 to 1;
       &trait = id + evr + 2*evr*ID - 3*block*evr + rand("Normal");
       output;
      end;
   end;
end;
end;
run;

ods trace on;
PROC MIXED DATA=WORK.bo_FAKE cl=wald covtest;
 CLASS ID BLOCK EVR ;
 MODEL &TRAIT=ID/s;
 Random  EVR EVR*ID BLOCK(EVR);
 LSMEANS ID; 
 ODS output lsmeans=BLUE_SG_trait;
 run;
STAT_Kathleen
SAS Employee
Also check that your PROC MIXED model converges. If the model fails to converge the ODS OUTPUT LSMEANS= data set would not be created.
IanWakeling
Barite | Level 11

If Kathleen is correct, then note that you can add ConvergenceStatus=<data set name> to the ODS output statement, and then read the variable called 'status' to determine if the model has failed to converge (a non-zero value indicates failure).

venkkat
Fluorite | Level 6

@IanWakeling  you were right  have tries to do as below script 

 PROC MIXED DATA=WORK.MBG cl=wald covtest;

 CLASS ID BLOCK EVR ;
 MODEL dw=ID/s;
 Random  EVR EVR*ID BLOCK(EVR);
 LSMEANS ID; 
 ODS output ConvergenceStatus=BLUE_SG_dw;
 run;
 quit;
 proc print data=BLUE_SG_dw;
   id status;
run;

i have found with error 1 in status that means convergence not met the criteria so it did not converge, 

 May i know which model is better fit to my data to calculate the lsmeans 

 

Thanks 

IanWakeling
Barite | Level 11

Looking at the ouput posted I wonder if you are modelling the correct data?  Mixed is saying that the class variable EVR has the value '1' for all observations - surely that is not what you intend?

 

Regarding my earlier comment  - the output from Mixed will always tell you about the convergence status of you model, my point is that when writing a macro that uses this proc it is always a good idea to get the macro to programmatically check the convergence status of the model.  You could do this by writing the value of 'status' to a macro variable and then making any further analysis contingent on the value being zero.

venkkat
Fluorite | Level 6

Hi @Rick_SAS  thanks for your response, i have tries without macros (trait by trait) it works for few traits and i am facing errors for some traits. for instance the Lsmeans for dry weight is generated but convergence is not met for Plant height. i have also wrote the script as ConvergenceStatus=work.mbg i have attached you the results of two analysis 

 

Thanks in advance 

jiltao
SAS Super FREQ
The specified model might not be appropriate for your data and therefore have caused convergence issues. If you can send in data that would be helpful.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 4962 views
  • 3 likes
  • 5 in conversation