BookmarkSubscribeRSS Feed
guest1994
Calcite | Level 5

Hello,

 

I'm wondering if anyone can assist me with this query below, I'm receiving a warning message 'Variable X already exists on file WORK.OMDM_JOIN' which is causing my entire code to not be complete. Does anyone know how I can fix this?

 

Many thanks

 

PROC SQL; 
	CREATE TABLE OMDM_JOIN AS 
	SELECT *
	,A.CSID
	,A.CSREQUESTNUMBER
	,A.TRANSACTION_DTTM
	,A.PROCESSED_DTTM
	,A.PRODUCT_CATEGORY
	,A.APPLICATIONSCORING
	,A.SOURCEOFAPPLICATION 
	,A.GUARANTEEDAPPLICATIONIND 
	,A.REPROCESSQUANTITY 
	,B.CIDPERSID AS CUS1_CIDPERSID
    ,C.CIDPERSID AS CUS2_CIDPERSID
	,D.SCOREMODELNAME 
	FROM SPDSWORK.OMDM_APPLICATION A 
	INNER JOIN SPDSWORK.APPLICANT (WHERE=(APPLICANT_SEQ=1)) B
	ON A.CSID = B.CSID
	INNER JOIN SPDSWORK.APPLICANT (WHERE=(APPLICANT_SEQ=2)) C
	ON A.CSID = C.CSID
	INNER JOIN SPDSWORK.APPLICATIONSCORING D
    ON A.CSID = D.CSID
	INNER JOIN SPDSWORK.DECISION E
    ON A.CSID = E.CSID
	INNER JOIN SPDSWORK.DMBIV F
    ON A.CSID = F.CSID
	;
	QUIT;

log:
WARNING: Variable CSID already exists on file WORK.OMDM_JOIN.
WARNING: Variable Transaction_dttm already exists on file WORK.OMDM_JOIN.
WARNING: Variable CSRequestNumber already exists on file WORK.OMDM_JOIN.
WARNING: Variable Product_Category already exists on file WORK.OMDM_JOIN.
WARNING: Variable processed_dttm already exists on file WORK.OMDM_JOIN.
WARNING: Variable CommitmentCount already exists on file WORK.OMDM_JOIN.
WARNING: Variable CommitmentAmount_1 already exists on file WORK.OMDM_JOIN

 

1 REPLY 1
Criptic
Lapis Lazuli | Level 10

You are using select * to select all columns of all tables and after that you specify some columns again and these are the one that you get warned about.

Solution either remove the select * and just select the columns you need or only use select * to get all columns. If you want to add the columns again you should give them a different name with A.CSID as cs_identification etc.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 1 reply
  • 845 views
  • 0 likes
  • 2 in conversation