BookmarkSubscribeRSS Feed
swimmer
Calcite | Level 5

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

2 REPLIES 2
Reeza
Super User

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;

PGStats
Opal | Level 21

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 405 views
  • 0 likes
  • 3 in conversation