Hi,
Refer to my July 20 post in this forum prior posting:
http://support.sas.com/forums/thread.jspa?messageID=6918ᬆ
Your easiest solution (in my opinion) is to use a SAS date constant in your where clause. The form that a date constant has to take is:
[pre]
"ddmmmyyyy"d or "ddmmyy"d
[/pre]
That means the best solution would be to set your parameter to the DATE9 form of the date and then you don't have to worry about conversion.
[pre]
data btime;
infile datalines;
input name $ bdtime : datetime.;
bdtime2 = bdtime;
return;
datalines;
anna 15Nov1950:07:15:00
barb 15Nov1950:10:45:32
cali 15Nov1950:06:33:27
dora 15Nov1950:03:25:59
yora 15Nov1960:04:04:07
zora 15Nov1984:11:56:32
;
run;
proc print date=btime;
title 'How to get ONLY the people born after November 15, 1950';
where datepart(bdtime) gt "15Nov1950"d;
format bdtime2 datetime20.;
run;
[/pre]
If your &BEGIN_DATE was already in the form 15Nov1950, then you could just code the above WHERE clause as:
[pre]
where datepart(bdtime) gt "&BEGIN_DATE"d;
[/pre]
BUT, if your users need/want to select a different date format, then you'll need to convert YOUR macro parm "&BEGIN_DATE from one form into another date form. So your stored process will have to contain macro code to perform the conversion before the WHERE clause:
[pre]
%let begin_date = 11/15/1950; /* mimics what is coming from user */
%let datenum = %sysfunc(inputn(&begin_date,anydtdte10.));
%let wantdate = %sysfunc(putn(&datenum,date9.));
ods listing;
proc print date=btime;
title 'How to "fix" when date is not initially in right form for date constant';
where datepart(bdtime) gt "&wantdate"d;
format bdtime2 datetime20.;
run;
[/pre]
cynthia