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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1684 views
  • 0 likes
  • 2 in conversation