Hi,
I use proc glm to run multiple regression model, I wonder if it is possible to display the categorical parameter level in format in the output. For example, I have the following output after proc glm,
where PROG has three levels, 1, 2, 3 with format as 1 = 'low', 2 = 'med', 3 = 'high'. Is it possible to display 'low', 'med', 'high' instead of 1, 2, 3 in the output? Thank you very much!
Parameter Estimate Error t Value Pr > |t|
Intercept 0.0510179965 B 0.18457670 0.28 0.7823
PROG 1 -.4233591913 B 0.07772768 -5.45 <.0001
PROG 2 -.1468757972 B 0.06539618 -2.25 0.0251
PROG 3 0.0000000000 B . . .
What does your code look like? Have you tried the standard class/format statements?
proc format;
value 1 = 'low'
2 = 'med'
3='high';
run;
proc glm data=have;
class prog;
model y=prog;
format prog prog_fmt.;
run;
The levels of PROG will be displayed as their formatted values if PROG is associated with a format, either in your dataset (permanent association) or during the glm procedure run (temporary association). For example
proc format;
value lmh
1 = 'low'
2 = 'med'
3 = 'high';
run;
proc glm data=myData;
format PROG lmh.; /* Associate format with CLASS variable */
class PROG;
model y = PROG / solution;
run;
PG
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.