Help using Base SAS procedures

Creating bands

Reply
Super Contributor
Posts: 259

Creating bands


Is there an easy way of creating band in SAS? I have a dataset where I would like to create bands for certain factors i.e. age etc. based on the volumn of data.

Super User
Posts: 5,431

Re: Creating bands

Is "band" a statistical term? If so, post this in Statistical Procedures forum instead to target your audience.

Data never sleeps
Super Contributor
Posts: 259

Re: Creating bands

Not really. I just want to create something like the following:

Age  Band

24     A.18-25

44     C.25-44

23     ...

65     ...

99

without having to define each level manually

So, given the width, lower and upper bounds i can create bands automatically

Super Contributor
Posts: 340

Re: Creating bands

Proc Format should work:


Data A;
  Input Age @@;
  Datalines;
  24 44 23 65 99 
  ;
Run;

Proc Format;
  Value AgeFormat 18-25  = "A"
                               25-44  = "C"
                               44-High = "Old" ;
Run;

Data B;
  Set A;
  Group=Put(Age,AgeFormat.);
Run;

Ask a Question
Discussion stats
  • 3 replies
  • 310 views
  • 0 likes
  • 3 in conversation