Write and run SAS programs in your web browser

ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

Reply
Contributor
Posts: 24

ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

can anyone  help to look at below log, i do not know where is the problem.

 

PROC SQL;
CREATE TABLE GC.GermanCredit_Guanantor
AS
SELECT GermanCredit.Guarantor,GermanCredit.CO-APPLICANT
,(CASE
WHEN ( Guarantor =1 or CO-APPLICANT = 1) THEN 1
ELSE 0
END) AS Guarantor
FROM GC.GermanCredit;
QUIT;

 

64 FROM GC.GermanCredit;
ERROR: Column CO could not be found in the table/view identified with the correlation name GERMANCREDIT.
ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.
Attachment
Grand Advisor
Posts: 16,303

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

GermanCredit.CO-APPLICANT -> this is not a valid variable name. It's either an underscore or possibly GermanCredit.'CO-APPLICANT'n

 

Run a proc contents on the dataset and see what the variable name is. 

Contributor
Posts: 24

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

but in the data, it does show as CO-APPLICANT, see attached screen shot. 

Attachment
Grand Advisor
Posts: 16,303

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

Then it's the second option I indicated with quotes. 

 

You need to reference it as a name literal. 

See details here

http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p18cdcs4v5wd2dn1q0x2...

Contributor
Posts: 24

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

i tried it, but it does not show what i want, it still shows as tow columns, not merge to be one column.

what i want it either column shows '1', then it shows results as '1, else'0', but as you can see it does not even merge to be one column. 

Attachment
Grand Advisor
Posts: 16,303

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

Your CASE statement is incorrect, you can't have two variables with the same name in a data step. 

I'm surprised the log doesn't have any errors. 

 

Post your corrected code and log please. 

 

To correct your CASE add the alias for each variable and give it a new, unique name. 

 

 

Contributor
Posts: 24

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

i change the name to be APPLICANT, and tried to run the log again, but still it shows error. 

Attachment
Grand Advisor
Posts: 16,303

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

What error? I don't see any error in your code or log. 

Contributor
Posts: 24

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

i got your point, i shall change it to be AS NewGuarantor, otherwise it is the same as the data variable, it works now, appreciate  your help!!

 

PROC SQL;
CREATE TABLE GC.GermanCredittApp
AS
SELECT GermanCreditt.Guarantor, GermanCreditt.APPLICANT
,(CASE
WHEN (Guarantor = 1 or APPLICANT = 1) THEN 1
ELSE 0
END) AS NewGuarantor
FROM GC.GermanCreditt;
QUIT;

Contributor
Posts: 24

Re: ERROR: The following columns were not found in the contributing tables: APPLICANT, CO.

i got your point, i shall change it to be AS NewGuarantor, otherwise it is the same as the data variable, it works now, appreciate  your help!!

 

PROC SQL;
CREATE TABLE GC.GermanCredittApp
AS
SELECT GermanCreditt.Guarantor, GermanCreditt.APPLICANT
,(CASE
WHEN (Guarantor = 1 or APPLICANT = 1) THEN 1
ELSE 0
END) AS NewGuarantor
FROM GC.GermanCreditt;
QUIT;

Attachment
Attachment
Post a Question
Discussion Stats
  • 9 replies
  • 270 views
  • 0 likes
  • 2 in conversation