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

;

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

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
  • 1 reply
  • 591 views
  • 0 likes
  • 2 in conversation