LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2010, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page