BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
twildone
Pyrite | Level 9

Hi...I a new to using the Proc Genmod procedure and I am using a model with the Class Variables Area and AgeGroup. After running the program, the output revealled that some of the AgeGroups can be combined. Is there a simple way of combining these AgeGroups together similiar to adding ref=<value> to the Class statement without having to this in the dataset before re-running the program. Thanks in Advance.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

One generic approach for this type of issue is to not create specific variables for age but assign a format that creates the groups needed. Then you make a custom format with the desired groupings and assign that format during the procedure execution.

Example format code:

proc format;

     value age5groups

     10 - 25 = '10 to 25'

     26 - 35 = '26 to 35'

     36 - 45 = '36 to 45'

     46 - 55 = '46 to 55'

     55 - high='56+';

     value age3groups

     10 - 25 = '10 to 25'

     26 - 45 = '26 to 45'

     46 - high = '46+';

run;

Assuming you age is integer years. Use the different format in the procedure by adding:

format age age5groups. ;

or

format age age3groups. ;

View solution in original post

1 REPLY 1
ballardw
Super User

One generic approach for this type of issue is to not create specific variables for age but assign a format that creates the groups needed. Then you make a custom format with the desired groupings and assign that format during the procedure execution.

Example format code:

proc format;

     value age5groups

     10 - 25 = '10 to 25'

     26 - 35 = '26 to 35'

     36 - 45 = '36 to 45'

     46 - 55 = '46 to 55'

     55 - high='56+';

     value age3groups

     10 - 25 = '10 to 25'

     26 - 45 = '26 to 45'

     46 - high = '46+';

run;

Assuming you age is integer years. Use the different format in the procedure by adding:

format age age5groups. ;

or

format age age3groups. ;

sas-innovate-2024.png

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.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1300 views
  • 0 likes
  • 2 in conversation