Hi all,
Proc mixed generates datasets where D8.4 implemented. Is there any way to switch this options off and see all figures? Besided further 'format _all_ informat _all_'.
Hi @DmytroYermak,
You may want to support Tom's SASware ballot suggestion "Add new dataset options for changing variable attributes other than name." Once this has been implemented you can specify different formats via a dataset option in the ODS OUTPUT statement.
Till then you can use PROC TEMPLATE to modify the relevant ODS template(s) if you really want. I normally don't do this because I wouldn't want to accidentally damage the default templates. However, following Example 1: Editing a Table Template That a SAS Procedure Uses I (grown up with SAS 6, i.e. without ODS) felt comfortable enough to give it a try.
ods path show;
to check where SAS would search for ODS templates and save new ones.Current ODS PATH list is: 1. WORK.TEMPLAT(UPDATE) 2. SASUSER.TEMPLAT(READ) 3. SASHELP.TMPLMST(READ)indicating that modified template definitions would be written to WORK.TEMPLAT, whereas the original templates would be read from SASHELP.TMPLMST (because I don't have the SASUSER.TEMPLAT store). But this may be different on your system, so you might need to submit an appropriate ODS PATH statement as suggested in the "Example 1" mentioned above.
parent = Stat.Mixed.tTests;
format = d8.4;
in various places, e.g., for lower and upper confidence limits (sections "define Lower" and "define Upper").proc template;
edit Stat.Mixed.tTests;
edit lower;
format=best24.;
end;
edit upper;
format=best24.;
end;
end;
run;
And, indeed, a subsequent run of PROC MIXED including an LSMEANS statement with CL option delivered lower and upper confidence limits of least squares means with plenty of decimals. Also the corresponding variables Lower and Upper in the ODS output dataset had the BEST24. format instead of D8.4.proc template;
delete Stat.Mixed.tTests;
run;
and everything is back to normal.That was interesting, but I still think that using a quick PROC DATASETS or DATA step to change the format would be easier.
Show us your code please.
Here it is:
ods output lsmeans=lsmean diffs=dif;
proc mixed data = set order=data;
class X1 X2 X3 X4 ;
model chg = X1 X3 X1*X3 base;
repeated X3 / subject=X2 type=un;
random intercept;
lsmeans X1*X3 / pdiff cl alpha=0.05;
run;
Thank you!
I don't know if result values can be reformatted within PROC MIXED. I have always done the reformatting in a post processing DATA step. I know that might not be much help.
SteveDenham
Hi @DmytroYermak,
You may want to support Tom's SASware ballot suggestion "Add new dataset options for changing variable attributes other than name." Once this has been implemented you can specify different formats via a dataset option in the ODS OUTPUT statement.
Till then you can use PROC TEMPLATE to modify the relevant ODS template(s) if you really want. I normally don't do this because I wouldn't want to accidentally damage the default templates. However, following Example 1: Editing a Table Template That a SAS Procedure Uses I (grown up with SAS 6, i.e. without ODS) felt comfortable enough to give it a try.
ods path show;
to check where SAS would search for ODS templates and save new ones.Current ODS PATH list is: 1. WORK.TEMPLAT(UPDATE) 2. SASUSER.TEMPLAT(READ) 3. SASHELP.TMPLMST(READ)indicating that modified template definitions would be written to WORK.TEMPLAT, whereas the original templates would be read from SASHELP.TMPLMST (because I don't have the SASUSER.TEMPLAT store). But this may be different on your system, so you might need to submit an appropriate ODS PATH statement as suggested in the "Example 1" mentioned above.
parent = Stat.Mixed.tTests;
format = d8.4;
in various places, e.g., for lower and upper confidence limits (sections "define Lower" and "define Upper").proc template;
edit Stat.Mixed.tTests;
edit lower;
format=best24.;
end;
edit upper;
format=best24.;
end;
end;
run;
And, indeed, a subsequent run of PROC MIXED including an LSMEANS statement with CL option delivered lower and upper confidence limits of least squares means with plenty of decimals. Also the corresponding variables Lower and Upper in the ODS output dataset had the BEST24. format instead of D8.4.proc template;
delete Stat.Mixed.tTests;
run;
and everything is back to normal.That was interesting, but I still think that using a quick PROC DATASETS or DATA step to change the format would be easier.
Thank you all for the detailed comments. In my case I have used a post processing re-formatting.
With that window open you can manually change the format, just type the one you want into the format or use the selection box.
Or Proc datasets can permanently change the format for any variable in place. The following pseudocode demonstrates how the change the format for the variable named Variable to newformat for the data set named Group in the library named Somelib.
proc datasets library=somelib nolist; modify group; format variable newformat.; quit;
Or use the desired format in a procedure like proc print or report when viewing results.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.