BookmarkSubscribeRSS Feed
Aalcorn
Calcite | Level 5

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!Smiley Happy
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 Smiley Happy

- 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

5 REPLIES 5
Reeza
Super User

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;

Aalcorn
Calcite | Level 5

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!

Marina
Calcite | Level 5

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

asdfghjkl__lpoi87654ewasxcv
Calcite | Level 5

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.

Aalcorn
Calcite | Level 5

I was able to fix the problem, a coworker was available to assist, thank you for everyone's help!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2623 views
  • 0 likes
  • 4 in conversation