BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

Any help to resolve this issue? Getting an error like unexpected 'on' at line number 4

 

 

update pre_claim_lin_1_test pci
set pci.LINE_DIA_PRIM_DESC = diag.description 
from (select max(description) description from COMDB.ON_DATA.MR_DIAGNOSIS_CODE c inner join raw.prepa_claim_inst r on r.PRINCIPAL_DIAG = c.DIAGNOSI_CODE
where  c.ICD1_INDICATOR<>'N')diag on 1=1 and pci.id  =7828 ;

 

​If I tried to remove ON and add WHERE, I'm getting an error like invalid  field diag.description 

update pre_claim_lin_1_test pci
set pci.LINE_DIA_PRIM_DESC = diag.description 
from (select max(description) description from COMDB.ON_DATA.MR_DIAGNOSIS_CODE c inner join raw.prepa_claim_inst r on r.PRINCIPAL_DIAG = c.DIAGNOSI_CODE
where  c.ICD1_INDICATOR<>'N')diag where pci.id  =7828 ;

 

3 REPLIES 3
Mazi
Pyrite | Level 9
data test;
	set sashelp.class;
	age=.;
run;

proc sql;
	update test a
		set age = (select age from sashelp.class as b where a.name = b.name);
quit;

Can you try something similar to this?

Create a temporary table first where you select the max description and use that table in the set statement.

If you have some sample data, please share it, and I can show you a practical example with your data.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 3 replies
  • 538 views
  • 0 likes
  • 3 in conversation