BookmarkSubscribeRSS Feed
MRB3855
Fluorite | Level 6

Suppose the output generated by the RANDOM statement (proc GLM) is the following:

                           Sum of                                                                                                                Error
Source     DF     Squares   Mean Square   Expected Mean Square                       Error Term        DF    F Value  Pr > F

Variety      3      0.810160     0.270053        Var(Residual) + 3.1795 Var(Variety)  MS(Residual)     9        4.79      0.0293
Residual   9      0.507917     0.056435        Var(Residual) 

 

And the same is output to the ODS Table ExpectedMeanSquares. Is there a way to increase the number of decimal places in the 3.1795 value (in the output and in the  ExpectedMeanSquares table)? For example, rather than 3.1795 being shown, 3.17947689 is shown? I'm currently using the compress function to extract the value from the expectedmeansquare variable in the ExpectedMeanSquares table, and I'd like more precision since I'm using the value in subsequent calculations. 

 

Regards

Mark                              .                          .          .            .

6 REPLIES 6
Reeza
Super User
Change the underlying format. How are you capturing the table, I'm assuming ODS OUTPUT? The table should have the underlying value with the full details.
MRB3855
Fluorite | Level 6

Yes, ODS output. The complicating thing is, the expectedmeansquare variable in the ODS output Table is a character variable. So I'm extracting the digits from a character variable.

 

Thanks!

Mark

ballardw
Super User

If you are referring to a variable in a data set created by ODS OUTPUT then it has inherited a default format. You can either change the format in the data set manually or with Proc Datasets. Or apply a different format for any report procedure at time of display.

In the code below the variable X has been assigned a format of Best4. meaning that it only displays 4 characters including a decimal if needed. This would be the default format as created by ODS OUTPUT. Then printing the same value a specified format involving 5 decimal points shows more digits.

data example;
   x = 123 / 7;
   format x best4.;
run;

proc print data=example;
   var x;
   format x 8.5;
run;
MRB3855
Fluorite | Level 6

The complicating thing is, the expectedmeansquare variable in the ODS output Table is a character variable. So I'm extracting the digits (via the compress function) from a character variable.

 

Thanks!

Reeza
Super User
If you can post some code & data to generate the table Ill take a look. Usually it has the numeric values as well as character values. Absolute worst case you can modify the template, and if it’s only character this is a perfectly good reason to change it permanently.

PS fake data and code is fine, just needs to generate the ODS table.
MRB3855
Fluorite | Level 6

Thanks Reeza: Here ya go!

/********/

DATA Untitled;
INPUT Damage Variety &$;
Lines;
3.9 A
3.6 B
4.15 C
3.35 D
4.05 A
4.2 B
4.6 C
3.8 D
4.25 A
4.05 B
4.15 C
3.85 B
4.4 C
;
RUN;

ods select none;
PROC glm DATA=Untitled ALPHA=0.05;
CLASS Variety;
MODEL Damage = Variety;
RANDOM Variety/Test;
ods output ExpectedMeanSquares=EMS;
RUN;
ods output close;
quit;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1416 views
  • 0 likes
  • 3 in conversation