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;
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.
but in the data, it does show as CO-APPLICANT, see attached screen shot.
Then it's the second option I indicated with quotes.
You need to reference it as a name literal.
See details here
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.
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.
i change the name to be APPLICANT, and tried to run the log again, but still it shows error.
What error? I don't see any error in your code or log.
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;
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;
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.