VERSION 4.3
So i am pretty sure the language here is wrong, remember i am new to this, any kind help would be appreciated!
if I select a field from one of my tables/another field ex: (t1.NCOVD_CHRG_AMT/t1.TOT_CHRG)
i get error
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 OPTION DEBUG=DBMS_SELECT SQL_IP_TRACE=(NOTE, SOURCE);
4 PROC SQL NOEXEC;
5 SELECT (t1.NCOVD_CHRG_AMT/t1.TOT_CHRG) AS CALCULATION
6 FROM TABLE1.MEDA_ADJUD_CLM_HDR t1, TABLE2.MEDA_ADJUD_CLM_RSN t2, TABLE3.MEDA_ADJUD_REVN_LN t3
7 QUIT;
______
22
76
ERROR 22-322: Syntax error, expecting one of the following: ',', GROUP, HAVING, ORDER, WHERE.
ERROR 76-322: Syntax error, statementw ill be ignored.
8 %PUT SQL IPTRACE_RESULT=&SYS_SQL_IP_ALL;
SQL_IPTRACE_RESULT=-1
9 OPTIONS SQL_IP_TRACE=(NONE);
10
11 QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
11 ! RUN;
12
????????? What would i need to use for the advanced expression to receive a percentage without an error
- PROC SQL NOEXEC;
SELECT (t1.NCOVD_CHRG_AMT/t1.TOT_CHRG) AS CALCULATION
FROM TABLE1.MEDA_ADJUD_CLM_HDR t1, TABLE2.MEDA_ADJUD_CLM_RSN t2, TABLE3.MEDA_ADJUD_REVN_LN t3
QUIT
Are you using Query Builder or writing your own code?
You have 3 tables provided as source tables, are you actually looking for information from 3 tables or only 1?
If you were writing code it would be something like the following, assuming 1 table is the source.
PROC SQL ;
CREATE TABLE WANT AS
SELECT t1. *, (t1.NCOVD_CHRG_AMT/t1.TOT_CHRG) AS PCT_Change format=percent8.2
FROM TABLE1.MEDA_ADJUD_CLM_HDR t1;
QUIT;
I am using query builder, and I am using information from one table only, i want to calculate an error rate, noncovere/total charges.
gosh i feel dumb in here!
Are you pulling some data from tables t2 and t3?
If you don't, you need to remove them from FROM clause and add semicolon (;) after t1 in FROM clause - i.e. at the end of SELECT statement.
If you do, you need to tell query how to connect them - add WHERE clause:
WHERE t1.some_field = t2.some_field
and t2.some_field = t3.some_field
The error being displayed is due to a missing semicolon after the select statement and before the quit statement. Suggest adding the ';' and reposting if you get a non-spurious error.
I was able to fix the problem, a coworker was available to assist, thank you for everyone's help!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.