02-07-2016 08:08 AM
Just having a problem with SAS not recognising one of my variables whilst I am trying to encode a new variable.
Basically the code looks like:
if CTA_LAD=1 OR CTA_CX or CTA_RCA=1 then CTAPP=1;
However, SAS seems to be creating a new variable for CTA_CX filled with missing values. As far as I can see I am typing the exact variable name as it appears in my original datasheets and the SAS output.
It is not doing this for any of my other recoding steps.
Thanks in advance for your support!
02-07-2016 08:24 AM
Addit: there was a missing space in the name that I only saw on proc print!
But now I am having a different problem:
When I try:
It replaces CTA(space)_CX with all missing values and creates a new variable CTA_CX which is also populated with missing values.
02-07-2016 08:36 AM
02-07-2016 08:44 AM
Run a proc contents to see your variable names instead of labels. I'm not sure your condition is specified correctly, I think you want what's below.
if CTA_LAD=1 OR CTA_CX=1 or CTA_RCA=1 then CTAPP=1; else CTAPP=0;
02-07-2016 06:41 PM
Thanks for the reply.
You're correct about that bit of code being incorrect, but the renaming step is where the error is occuring in that it is creating the new variable. I copied the exact title from a PROC PRINT statement and its not working. I guess I'll just edit the original spreadsheet and try again, would have been interesting to know why this was happening.