Help using Base SAS procedures

Creating a Column with Ranges

Reply
Contributor
Posts: 37

Creating a Column with Ranges

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.

PROC Star
Posts: 7,481

Creating a Column with Ranges

Posted in reply to AAWTomHanks

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

;

Ask a Question
Discussion stats
  • 1 reply
  • 111 views
  • 0 likes
  • 2 in conversation