display categorical parameter level in format

Reply
Contributor
Posts: 36

display categorical parameter level in format

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

Super User
Posts: 19,877

Re: display categorical parameter level in format

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;

Respected Advisor
Posts: 4,935

Re: display categorical parameter level in format

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

PG
Ask a Question
Discussion stats
  • 2 replies
  • 172 views
  • 0 likes
  • 3 in conversation