Date: Tue, 27 Aug 2002 15:27:42 +0100
Reply-To: Peter Crawford <peter.crawford@DB.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Crawford <peter.crawford@DB.COM>
Subject: Re: converting dates
Content-type: text/plain; charset=iso-8859-1
how about the function yyq()
Unfortunately, it needs separate year and qtr, but
check out this demo
193 data;
194 do yourdate = 198401 to 198404 ;
195 sasdate = yyq( yourdate/100, mod( yourdate,100 ) );
196 put yourdate= sasdate= sasdate=date9. sasdate=yyq. ;
197 end;
198 run;
yourdate=198401 sasdate=8766 sasdate=01JAN1984 sasdate=1984Q1
yourdate=198402 sasdate=8857 sasdate=01APR1984 sasdate=1984Q2
yourdate=198403 sasdate=8948 sasdate=01JUL1984 sasdate=1984Q3
yourdate=198404 sasdate=9040 sasdate=01OCT1984 sasdate=1984Q4
NOTE: The data
Of course whether it should be performed
in a separate datastep
in a datastep or sql view of the original
or in the preparation of the original data
depends on more info than you provided
Datum: 27/08/2002 13:47
An: SAS-L@LISTSERV.UGA.EDU
Antwort an: Matt <barenmat@YAHOO.COM>
Betreff: converting dates
Nachrichtentext:
Hello,
I have a variable in the following numeric format (representing
quarters of the year) [already in a SAS data set]:
198401
198402
198403
198404
198501
...
I would like to convert this to SAS dates, so that then I could use
this variable in the proc x11, to adjust for seasonality as follows (I
need to convert the above to the newSASdatevar I refer to below):
proc x11 data = mydata;
quarterly date = newSASdatevar;
var myvar;
tables d11;
run;
Thank you very much for any tips you may have,
Matt
P.S. Thanks for the help on my last inquiry.
--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.