BookmarkSubscribeRSS Feed
Baba9
Obsidian | Level 7
 proc sql;
1397  create table DADFY19_int  as
1398  select distinct a.princ_interv_cci_code,a.DAD_TRANSACTION_ID as TXN_ID_AB,
1398! a.ANALYTICAL_INST_TYPE_CODE,
1399  a.ADMISSION_CATEGORY, a.ENTRY_CODE,a.submitting_prov_code, a.PROV,
1400  b.DAD_TRANSACTION_ID,b.INTERV_CCI_CODE, b.INTERV_SEQ_ID, b.EPISODE_SEQ_ID,
1401  b.STATUS_ATTRIBUTE_CODE, b.OOH_IND, b.ANESTHETIC_TECH
1402  from abs_AC_F1920_excl_QC_BC as a
1403  inner join dad19sas.interv as b
1404  on a.DAD_TRANSACTION_ID=b.DAD_TRANSACTION_ID
1405  where b.INTERV_SEQ_ID=1 and b.EPISODE_SEQ_ID=1
1406  and b.INTERV_CCI_CODE not in('','5CA20', '5CA24', '5CA88', '5CA89', '5CA90', 'ZZZZZZZZZZ' )
1407  and UPCASE(b.STATUS_ATTRIBUTE_CODE) NOT IN ('A') and b.OOH_IND not in ('Y')
1408  inner join dad19sas.diagnosis as b
      -----
      22
      76
ERROR 22-322: Syntax error, expecting one of the following: ;, !, &, AND, EXCEPT, GROUP, HAVING,
              INTERSECT, OR, ORDER, OUTER, UNION, |.

ERROR 76-322: Syntax error, statement will be ignored.

1409  on a.DAD_TRANSACTION_ID=b.DAD_TRANSACTION_ID
1410  where substr(diag_icd10_code,1,3)  in ('O04','O07') or substr(diag_icd10_code,1,4) in
1410! ('P964')
1411  ;
1411!  quit;

Any advice on how to correctly join multiple tables?

1 REPLY 1
Reeza
Super User
Move the inner join (and all joins before the WHERE

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 643 views
  • 1 like
  • 2 in conversation