BookmarkSubscribeRSS Feed
Sang90
Calcite | Level 5

I am trying to get the sum of two columns from a table called account sales (ACC_SLS) but i am getting sqlcode 098 in sas log.

 

SAS logic

 

PROC DB2EXT OUT=UNBSALE;
SELECT A.ACC_NO AS ACCNO,
SUM(SLS_FUE_GRS_AMT) AS FULGRS,
SUM(SLS_OTH_GRS_AMT) AS OTHGRS
FROM &ACCMST AS A LEFT OUTER JOIN
&ACCSLS AS B ON
A.ACC_NO=B.ACC_NO WHERE
(A.ACC_ACC_STS_CD = 'A' AND
A.ACC_BLG_TSM_TYP = 'B' AND
B.ACC_CYC_NO = +19 AND
B.WK_INV_DT = '9999-12-31')
GROUP BY A.ACC_NO
ORDER BY 1;;
RUN;

 

 

SAS error:

 

DB2 WARNING:
RESULT OF SQL STATEMENT:
DSN00098W A DYNAMIC SQL STATEMENT ENDS WITH A SEMICOLON
A DUMP OF THE SQLCA FOR THE GET DIAGNOSTICS REQUEST FOLLOWS:
ROW NUMBER: 0 ERROR CONDITION: 1 REASON CODE: 0
SQLCODE: 98 SQLSTATE: 01568 SQLERRP: DSNHTOKR

3 REPLIES 3
SASKiwi
PROC Star

You have any extra semicolon on your query that could be removed. Don't know if that is causing the error.

Sang90
Calcite | Level 5
If i remove the semicolon, I am getting a SAS error like "expecting ;". So
i provided two semicolons
SASKiwi
PROC Star

Might help to post the complete SAS log but specify  - options mprint; - before running the program so the macro reference &ACCSLS resolves.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1138 views
  • 0 likes
  • 2 in conversation