I'm trying to create a connecting letters report from my proc mixed. I've loaded the pdmix800.sas macro into SAS Studio, and added the lines as the example in the usage notes did (also included below). However I'm getting errors from the listing function, and the program is not recognizing diff either. These issues are terminating PDMIX800. Anyone know what I'm doing wrong?
Code:
/*with macro*/ proc mixed data=data; class age sex tp name; model weight = age sex age*sex; repeated TP / type=UN r rcorr subject= name; ods listing exclude lsmeans diff; LSMEANS age / pdiff adjust=TUKEY; ods output diff=ppp lsmeans=mmm; *insert other statements such as contrast, estimate, etc; run; %include '/home/u63229971/sasuser.v94/folder1/pdmix800.sas'; %pdmix800(ppp,mmm,alpha=.05,sort=no); run;
Errors:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; NOTE: ODS statements in the SAS Studio environment may disable some output features. 69 70 /*with macro*/ 71 proc mixed data=data; 72 class age sex tp name; 73 model weight = age sex age*sex; 74 repeated TP / type=UN r rcorr subject= name; 75 ods listing exclude lsmeans diff; ERROR: The LISTING destination is not active; no select/exclude lists are available. ERROR: The LISTING destination is not active; no select/exclude lists are available. 76 LSMEANS age / pdiff adjust=TUKEY; 77 ods output diff=ppp lsmeans=mmm; 78 *insert other statements such as contrast, estimate, etc; 79 run; NOTE: Convergence criteria met. NOTE: The data set WORK.MMM has 12 observations and 7 variables. WARNING: Output 'diff' 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. NOTE: PROCEDURE MIXED used (Total process time): real time 0.31 seconds user cpu time 0.32 seconds system cpu time 0.00 seconds memory 3023.12k OS Memory 23212.00k Timestamp 08/28/2024 07:59:14 PM Step Count 87 Switch Count 6 Page Faults 0 Page Reclaims 446 Page Swaps 0 Voluntary Context Switches 54 Involuntary Context Switches 2 Block Input Operations 0 Block Output Operations 648 80 %include '/home/u63229971/sasuser.v94/iPUP/pdmix800.sas'; 708 %pdmix800(ppp,mmm,alpha=.05,sort=no); WARNING: Dataset ppp does not exist. NOTE: PDMIX800 terminated due to errors in input values. 709 run; 710 711 712 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 722
Add this before the macro
ods listing;
I added that before the "ods listing exclude lsmeans pdiff;" line, which seems to have fixed the first error.
However, now the program is still unable to make the output table from the pdiffs. I've tried both "pdiff" and "diff" but it doesn't recognize either. The lsmeans output data from the same line works fine.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; NOTE: ODS statements in the SAS Studio environment may disable some output features. 69 70 /*with macro*/ 71 proc mixed data=data; 72 class age sex tp name; 73 model weight = age sex age*sex; 74 repeated TP / type=UN r rcorr subject= name; 75 LSMEANS age / pdiff adjust=TUKEY; 76 ods listing ; 77 ods listing exclude lsmeans pdiff; 78 ods output pdiff=ppp lsmeans=mmm; 79 *insert other statements such as contrast, estimate, etc; 80 run; NOTE: Convergence criteria met. NOTE: The data set WORK.MMM has 12 observations and 7 variables. WARNING: Output 'pdiff' 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. NOTE: The PROCEDURE MIXED printed pages 13-18. NOTE: PROCEDURE MIXED used (Total process time): real time 0.32 seconds user cpu time 0.32 seconds system cpu time 0.01 seconds memory 4372.28k OS Memory 24492.00k Timestamp 08/28/2024 08:23:16 PM Step Count 123 Switch Count 7 Page Faults 0 Page Reclaims 828 Page Swaps 0 Voluntary Context Switches 59 Involuntary Context Switches 3 Block Input Operations 0 Block Output Operations 648 81 %include '/home/u63229971/sasuser.v94/iPUP/pdmix800.sas'; 709 %pdmix800(ppp,mmm,alpha=.05,sort=no); WARNING: Dataset ppp does not exist. NOTE: PDMIX800 terminated due to errors in input values. 710 run; 711 712 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 722
Try this instead of the line you have in your code
ods listing exclude lsmeans;
although honestly I don' see why you want this either, maybe you'd be better off just getting rid of this line.
In the notes they mention that as the macro will populate the same tables, they exclude those two tables in the initial output. So seems to be a matter of preference. However, excluding that line does not fix the warning. The issue appears to be the next line
ods output pdiff=ppp lsmeans=mmm;
Where the lsmeans results table and the pdiff results tables are turned into data tables. SAS is not recognising the diff output which means it doesn't create the PPP data needed for the next function. The results table it's trying to reference "Differences of Least Squares Means" is populating when I run the program, so I suspect the "name" is just wrong.
Fixing (or removing) ods listing exclude will solve the problem.
I removed ods exclude but the warning still occurs.
Show me the log.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; NOTE: ODS statements in the SAS Studio environment may disable some output features. 69 70 proc mixed data=data; 71 class age sex tp name; 72 model weight = age sex age*sex; 73 repeated TP / type=UN r rcorr subject= name; 74 LSMEANS age / pdiff adjust=TUKEY; 75 ods listing ; 76 ods output diff=ppp lsmeans=mmm; 77 *insert other statements such as contrast, estimate, etc; 78 run; NOTE: Convergence criteria met. NOTE: The data set WORK.MMM has 12 observations and 7 variables. WARNING: Output 'diff' 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. NOTE: The PROCEDURE MIXED printed pages 13-18. NOTE: PROCEDURE MIXED used (Total process time): real time 0.31 seconds user cpu time 0.31 seconds system cpu time 0.00 seconds memory 4378.12k OS Memory 24492.00k Timestamp 08/28/2024 09:03:44 PM Step Count 49 Switch Count 6 Page Faults 0 Page Reclaims 901 Page Swaps 0 Voluntary Context Switches 53 Involuntary Context Switches 5 Block Input Operations 0 Block Output Operations 640 79 %include '/home/u63229971/sasuser.v94/iPUP/pdmix800.sas'; 707 %pdmix800(ppp,mmm,alpha=.05,sort=no); WARNING: Dataset ppp does not exist. NOTE: PDMIX800 terminated due to errors in input values. 708 run; 709 710 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 720 User: u63229971
ods output diffs=ppp lsmeans=mmm;
Note the letter 's' after diff. Also, since you are doing this in SAS Studio, I don't think you need ODS LISTING;
t worked!! Thanks so much for helping me troubleshoot
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.