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 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 24 Jun 2005 09:50:24 -0400
Reply-To:     "Elmaache, Hamani" <Hamani.Elmaache1@CCRA-ADRC.GC.CA>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Elmaache, Hamani" <Hamani.Elmaache1@CCRA-ADRC.GC.CA>
Subject:      Re: Date Format Problem
Comments: To: Guido T <cymraeg_erict@hotmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Yes, it works very well. Thanks Hamani.

-----Original Message----- From: Guido T [mailto:cymraeg_erict@hotmail.com] Sent: June 24, 2005 9:45 AM To: Hamani.Elmaache1@CCRA-ADRC.GC.CA; SAS-L@LISTSERV.UGA.EDU Subject: RE: Date Format Problem

Hi,

Try using the year() function.

data one ; format date date9.; informat date date9.; do i = 0 to 12; date = intnx('month','01jan1966'd, i*3, 'b'); yearx = year(date); output; end; run;

HTH ++Guido >From: "Elmaache, Hamani" <Hamani.Elmaache1@CCRA-ADRC.GC.CA> >Reply-To: "Elmaache, Hamani" <Hamani.Elmaache1@CCRA-ADRC.GC.CA> >To: SAS-L@LISTSERV.UGA.EDU >Subject: Date Format Problem >Date: Fri, 24 Jun 2005 09:33:35 -0400 > > Hi there. >I have problem to get year from the following data: > >date > >01JAN1966 >01APR1966 >01JUL1966 >01OCT1966 >01JAN1967 >01APR1967 >01JUL1967 >01OCT1967 >01JAN1968 >01APR1968 >01JUL1968 >01OCT1968 >01JAN1969 > >I want just the year, some like this: > >date year >01Jan66 1966 >01Apr66 1966 >01Jul66 1966 >01Oct66 1966 >01Jan67 1967 >01Apr67 1967 >01Jul67 1967 >01Oct67 1967 >01Jan68 1968 >01Apr68 1968 >01Jul68 1968 >01Oct68 1968 >01Jan69 1969 > >I've tried many codes but don't work. >Here one of these codes: > > > >data one ; >format date date9.; >informat date date9.; >do i = 0 to 12; > date = intnx('month','01jan1966'd, i*3, 'b'); >year = SUBSTR(date,INDEX(date,' ')); >year0=input(year,date7.); >year1=input(year,best4.); >year2=input(year,8.); > > output; >end; >run; > >proc print data=one; >run; > >Thanks for any help, and have great week-end.


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