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 . . . .
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
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;
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!
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;
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!
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.