Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Proc SQL creates a table but does not populate it! 1

Status
Not open for further replies.

RinaGreen

Technical User
Mar 8, 2005
31
US
Hi Everybody,

I am in a trouble with a Proc SQL which I implemented as below:
************************************************************

libname DA 'C:\MYfolder\SAS Datasets';

proc sql;

create table da.Den as
select * FROM da.combineBothTbls mc
join DA.LAB bb
on mc.id = bb.lr_id
join DA.LOI ll
on ll.Value_Start = bb.LR_RSLT
WHERE mc.rule_id EQ 'N1'
AND mc.Rsn NE 'NO'
AND mc.Tag EQ 'DA'
AND bb.lr_dt_day ge '01Jan2004'd
AND bb.lr_dt_day le '31Jan2004'd;
run;
************************************************************
I got the following log and I do have den table created but not populated...
Log:
Note Table DA.DEN created, with 0 rows and 36 columns.
run;

NOTE PROC SQL statements are executed immediately; The RUN statement has no effect

**********************************

Is there something wrong with bb.lr_dt_day ge '01Jan2004'd statement?

Actual date value under bb.lr_dt_day look like the following:

08JAN2004:00:00:00


What I am doing wrong?

Could you please give me a hand?

Thank you!

Rina
 
Rina,
That date in your table is in datetime format (the number of seconds since 1/1/1960). The date that you have in your SQL code would resolve to the number of DAYS since 1/1/1960.

Perhaps you can use the datepart function on your var and match to the date you have in the statement.
ex...
datepart( bb.lr_dt_day) ge '01Jan2004'd

Klaz
 
Also, the log message about the run statement can be avoided by replacing "RUN;" with a "QUIT;" as that is the appropriate terminator for a Proc SQL step.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top