## re: PROC GENMOD

Solved
Regular Contributor
Posts: 237

# re: PROC GENMOD

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.

Accepted Solutions
Solution
‎03-13-2015 11:58 AM
Super User
Posts: 11,822

## Re: re: PROC GENMOD

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

All Replies
Solution
‎03-13-2015 11:58 AM
Super User
Posts: 11,822

## Re: re: PROC GENMOD

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats