Date: Mon, 1 Oct 2007 20:09:54 -0500
Reply-To: OR Stats <stats112@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: OR Stats <stats112@GMAIL.COM>
Subject: Re: Txt to Date SAS
Content-Type: text/plain; charset=ISO-8859-1
Sure, the query seems simple enough, but the syntax is not working:
MMMYY=input(monthyr,monYY5.); /*original date variable was called
'monthyr' which was txt*/
where (MMMYY< 'Aug06' and MMMYY> 'May05'); /*my date range of interest*/
The 2nd data step did not return the subset; inserting a 01 for the day also
did not return results.
On 10/1/07, Nordlund, Dan (DSHS/RDA) <NordlDJ@dshs.wa.gov> wrote:
> > -----Original Message-----
> > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> > Behalf Of OR Stats
> > Sent: Monday, October 01, 2007 5:38 PM
> > To: SAS-L@LISTSERV.UGA.EDU
> > Subject: Re: Txt to Date SAS
> > Yes, that's true... And how would one run date range queries
> > from this new
> > variable then? I presume I could use PROC SQL; however, the
> > comparative
> > range should be in what format then?
> > Moreover, if I would generate a time series graph based on my
> > new variable
> > and print only MonYY, what is the customization syntax I need
> > in SAS to
> > exclude the artificial 'day' in the x-axis?
> > Cheers!
> The second question is easiest; just format the date using the monyy5.
> format. That is one of the primary purposes of formats, i.e., to change
> how a variable is displayed on output (whether graphics or text, or ...).
> As for your first question, how you would run date range queries depends
> on what you are trying to do. PROC SQL may be what you want, but a data
> step or some other method of accessing the data might work as well. Can you
> give a description or an example of the kind of query that you want to do
> (pseudo code would be acceptable). If you do, I am sure someone on the list
> can help.
> Hope this is helpful,
> Daniel J. Nordlund
> Research and Data Analysis
> Washington State Department of Social and Health Services
> Olympia, WA 98504-5204