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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with the IN statement in Proc SQL;

Status
Not open for further replies.

dolfin013

Programmer
Apr 30, 2001
5
0
0
CA
Here is my dilemma,

When my WORK.bn2000 table hits the IN statement in verifies that a bus_reg_nb(PK) is not in the BN2001 table. The problem is that as soon as i reference a second
table(t2_income_stmt t2_is), it gives me a shared memery address error. I need to use the 2 tables in the query in order for it to function properly. The Error message I receive is as follows.

/*
Error: Read Access Violation In Task [SQL]
Exception occurred at [5EEF7EFF]
Task Traceback
*/

PROC SQL;
CREATE TABLE WORK.bn2001 as
SELECT t2_fd.bus_reg_nbr,t2_fd.ref_yr_cd,t2_fd.fpe_dt,t2_fd.fps_dt
FROM tms.t2_financial_declaration t2_fd, tms.t2_income_stmt t2_is
WHERE t2_fd.ref_yr_cd = '2001' AND
T2_FD.REF_YR_CD = t2_is.REF_YR_CD AND
T2_FD.BUS_REG_NBR = t2_is.BUS_REG_NBR AND
T2_FD.BN_ACCT_SQNBR = t2_is.BN_ACCT_SQNBR AND
T2_FD.FPE_DT = t2_is.FPE_DT AND
T2_FD.FPS_DT = t2_is.FPS_DT AND

(t2_fd.fpe_dt - t2_fd.fps_dt) >= 30 AND
(t2_fd.dnr_find_mdul_nbr = '0' or
t2_fd.dnr_find_mdul_nbr = '1' or
t2_fd.dnr_find_mdul_nbr is null)
ORDER by T2_FD.fpe_dt desc
;
QUIT;

PROC SORT data=WORK.bn2001 nodupkey;
by bus_reg_nbr ref_yr_cd;
QUIT;


PROC SQL;
CREATE TABLE WORK.bn2000 as
SELECT t2_fd.bus_reg_nbr,
t2_fd.ref_yr_cd,
t2_fd.fpe_dt,
t2_fd.fps_dt
FROM tms.t2_financial_declaration t2_fd, tms.t2_income_stmt t2_is
WHERE t2_fd.ref_yr_cd = '2001' AND
T2_FD.REF_YR_CD = t2_is.REF_YR_CD AND
T2_FD.BUS_REG_NBR = t2_is.BUS_REG_NBR AND
T2_FD.BN_ACCT_SQNBR = t2_is.BN_ACCT_SQNBR AND
T2_FD.FPE_DT = t2_is.FPE_DT AND
T2_FD.FPS_DT = t2_is.FPS_DT AND

(t2_fd.fpe_dt - t2_fd.fps_dt) >= 30 AND
(t2_fd.dnr_find_mdul_nbr = '0' or
t2_fd.dnr_find_mdul_nbr = '1' or
t2_fd.dnr_find_mdul_nbr is null) AND
t2_fd.bus_reg_nbr not in
(SELECT bus_reg_nbr FROM work.bn2001 )
;
QUIT;

PROC SORT data = work.bn2000 ;
by descending fpe_dt ;
QUIT;

PROC SORT data= work.bn2000 nodupkey;
by bus_reg_nbr ref_yr_cd;
QUIT;

 
Hi;

Have tried leaving PROC SQL (where I always get strange errors with anything I do) and doing what you want in a qualified DATA statement with a KEEP thrown in?I think that PROC SQL uses memory differently, hence the error message.

Hope that helps at all.

g "Man is the cheapest computer we can put into a spacecraft and the only one we can mass-produce with unskilled labor." Werner von Braun

 
I upgraded to SAS 8.2 and the problem disappeared. It had something to do with a memory problem which they fixed in version 8.2 ... Thanks for taking the time to reply. I suggest the upgrade if you have not already, It seams that they have solved quite a few of my Proc SQL; dilemmas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top