| Date: | Wed, 30 Jun 2010 14:19:26 -0700 |
| Reply-To: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Subject: | Re: Obtaining Decade from year variable |
| Content-Type: | text/plain; charset=ISO-8859-1 |
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...@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
|