BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DmytroYermak
Lapis Lazuli | Level 10

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_'. 

 

1.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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.

 

  1. Save a copy of SASHELP.TMPLSTAT (just in case). I copied all files named tmplstat*.sas7bitm found in the SASHELP library.
  2. Submit 
    ods path show;
    to check where SAS would search for ODS templates and save new ones.
    In my SAS session the result was:
    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.
  3. Browse the original template: With activated Results window go (in the main menu) to View --> Templates --> Sashelp.Tmplstat --> Stat --> Mixed. Right-click on, say, LSMeans and select "Open" from the context menu. There it says (among a few other things, but not format specifications)
    parent = Stat.Mixed.tTests;
  4.  So, open tTests instead of LSMeans. There you see the specification 
    format = d8.4;
    in various places, e.g., for lower and upper confidence limits (sections "define Lower" and "define Upper").
  5. Just as an example, I submitted the step
    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.
  6. Submit
    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.

 

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Show us your code please.

DmytroYermak
Lapis Lazuli | Level 10

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!

SteveDenham
Jade | Level 19

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

FreelanceReinh
Jade | Level 19

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.

 

  1. Save a copy of SASHELP.TMPLSTAT (just in case). I copied all files named tmplstat*.sas7bitm found in the SASHELP library.
  2. Submit 
    ods path show;
    to check where SAS would search for ODS templates and save new ones.
    In my SAS session the result was:
    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.
  3. Browse the original template: With activated Results window go (in the main menu) to View --> Templates --> Sashelp.Tmplstat --> Stat --> Mixed. Right-click on, say, LSMeans and select "Open" from the context menu. There it says (among a few other things, but not format specifications)
    parent = Stat.Mixed.tTests;
  4.  So, open tTests instead of LSMeans. There you see the specification 
    format = d8.4;
    in various places, e.g., for lower and upper confidence limits (sections "define Lower" and "define Upper").
  5. Just as an example, I submitted the step
    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.
  6. Submit
    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.

 

DmytroYermak
Lapis Lazuli | Level 10

Thank you all for the detailed comments. In my case I have used a post processing re-formatting.

ballardw
Super User

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 2873 views
  • 6 likes
  • 5 in conversation