BookmarkSubscribeRSS Feed
AAWTomHanks
Calcite | Level 5

I need to create a new column called Age_Bracket and I want it to include age ranges. I have an Age column already with numbers ranging from 0 to 99. If the Age column falls within lets say 0 to 25 I want the new column to say '0-25', if the age is between 26 and 64 I want the new column to say '26-64', and if the age is 65+ I want the new column to say '65+'. Any help would be greatly appreciated.

1 REPLY 1
art297
Opal | Level 21

proc format;

  value ages

  0-25="0-25"

  26-64="26-64"

  65-high="65+"

  ;

run;

data have;

  input age;

  age_bracket=put(age,ages.);

  cards;

0

1

2

15

27

88

;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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