From: Yaw on
Dear all:

I want to categorize a year variable I have into decade. The visit/
treatment spans from 1970 to 2008.

Does anybody know an efficient way of going around this task?

Data I have:

ID visityr
1 1975
1 1981
2 1999
2 2001;


I want something like

Id visitdecade;

1 70
1 80
2 90
2 100,

etc. or any workable format.


Thanks,
Yaw
From: Arthur Tabachneck on
Yaw,

You could use something like:

data have;
input ID visityr;
cards;
1 1975
1 1981
2 1999
2 2001
;

data want;
set have;
decade=10*FLOOR((visityr-1900)/10);
run;

HTH,
Art
------------
On Jun 30, 2:24 pm, Yaw <link...(a)gmail.com> wrote:
> Dear all:
>
> I want to categorize a year variable I have into decade.  The visit/
> treatment spans from 1970 to 2008.
>
> Does anybody know an efficient way of going around this task?
>
> Data I have:
>
> ID    visityr
> 1     1975
> 1      1981
> 2      1999
> 2      2001;
>
> I want something like
>
> Id   visitdecade;
>
> 1    70
> 1    80
> 2    90
> 2   100,
>
> etc.  or any workable format.
>
> Thanks,
> Yaw