| Date: | Wed, 7 Jul 2010 16:47:02 +0000 |
| Reply-To: | toby dunn <tobydunn@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | toby dunn <tobydunn@HOTMAIL.COM> |
| Subject: | Re: Pass date values |
|
| In-Reply-To: | <201007070628.o674HJNF026563@willow.cc.uga.edu> |
| Content-Type: | text/plain; charset="iso-8859-1" |
It pretty easy take the values you have and trun them into a SAS Date value. Since the day is not passed and the Date value you have in your data set is Date9, which means it will have a day value, you will need to sync the two up.
%Let Month = January ;
%Let Year = 2010 ;
%Let Date = %SysEvalF( "01%Substr(&Month, 1 , 3)&Year"d ) ;
Proc SQL ;
Select *
From xyz
Where IntnX( 'Month' , xyz_date , 0 , 'B' )
=
&Date ;
Quit ;
Here I took the information passed and contructed a SAS Date value from it in the third %Let statement. Giving it the first day of the month.
Then used that value in the where clause in the SQL procedure, where I used the IntnX function to push the Date value to the first of the month. Now the comparison will work.
Toby Dunn
"Don't bail. The best gold is at the bottom of barrels of crap."
Randy Pausch
"Be prepared. Luck is where preparation meets opportunity."
Randy Pausch
> Date: Wed, 7 Jul 2010 02:28:59 -0400
> From: peesari.mahesh@GMAIL.COM
> Subject: Pass date values
> To: SAS-L@LISTSERV.UGA.EDU
>
> dear all;
>
> i have data as date values in date9. format,i will enter values from
> external browser
> as month=january and year=1995,how shld i write code to compare this
> values with the values in data set,
>
> proc sql;
> select * from xyz
> where mn=&month. and yr=&year.
> quit;
>
>
> Thanks
> Mike
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2 |