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 (October 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 23 Oct 2009 16:40:03 -0400
Reply-To:   Norm Weston <nweston@AMGEN.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Norm Weston <nweston@AMGEN.COM>
Subject:   Re: converting text to date to quarter

There is probably a more elegent way of doing it, but this should get you there:

DATA HAVE; INPUT date $17.; CARDS; January 2008 February 2008 ; RUN;

DATA WANT; SET HAVE; FORMAT QUARTER YYQ6. ; DATE=UPCASE(DATE); XVAL = SUBSTR(DATE,1,3)||COMPRESS(DATE,COMPRESS(DATE,'1234567890')); QUARTER = INPUT(XVAL,MONYY7.); DROP XVAL; RUN;


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