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.

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
  • 2841 views
  • 0 likes
  • 2 in conversation