Hi everyone. I am having trouble working with a string variable in SPSS. When I try “if” commands using the string variable (if studyid=SLMD03041982) I keep getting this error in SPSS 20 “Incorrect variable name: either the name is more
than 64 characters or it is not defined by a previous command.” But the variable is in my dataset, so I’m not sure what the problem might be. I tried this in my own syntax just to see if my “if” command was causing the problem, but I still encountered the error when I tried to recode using point and click, specifying the “if” function. I’d appreciate any advice/assistance in
this regard. Man thanks, Stephanie Stephanie L. Marhefka, Ph.D. Assistant Professor Community and Family Health College of Public Health University of South Florida |
Stephanie, You’re working with string data values. They have to be enclosed in quotes or apostrophes when referred to statements, as in if studyid=’SLMD03041982’. Gene Maguin From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Marhefka, Stephanie Hi everyone. I am having trouble working with a string variable in SPSS. When I try “if” commands using the string variable (if studyid=SLMD03041982) I keep getting this error in SPSS 20 “Incorrect variable name: either the name is more than 64 characters or it is not defined by a previous command.” But the variable is in my dataset, so I’m not sure what the problem might be. I tried this in my own syntax just to see if my “if” command was causing the problem, but I still encountered the error when I tried to recode using point and click, specifying the “if” function. I’d appreciate any advice/assistance in this regard. Man thanks, Stephanie Stephanie L. Marhefka, Ph.D. Assistant Professor Community and Family Health College of Public Health University of South Florida |
In reply to this post by Marhefka, Stephanie
String value must be quoted.
Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] Phone: 312.893.4922 | T/L: 206-4922 From: "Marhefka, Stephanie" <[hidden email]> To: [hidden email] Date: 06/11/2012 10:11 AM Subject: Variable name not recognized Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi everyone. I am having trouble working with a string variable in SPSS. When I try “if” commands using the string variable (if studyid=SLMD03041982) I keep getting this error in SPSS 20 “Incorrect variable name: either the name is more than 64 characters or it is not defined by a previous command.” But the variable is in my dataset, so I’m not sure what the problem might be. I tried this in my own syntax just to see if my “if” command was causing the problem, but I still encountered the error when I tried to recode using point and click, specifying the “if” function. I’d appreciate any advice/assistance in this regard. Man thanks, Stephanie Stephanie L. Marhefka, Ph.D. Assistant Professor Community and Family Health College of Public Health University of South Florida |
Free forum by Nabble | Edit this page |