Variable name not recognized

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable name not recognized

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

 

Reply | Threaded
Open this post in threaded view
|

Re: Variable name not recognized

Maguin, Eugene

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
Sent: Monday, June 11, 2012 11:09 AM
To: [hidden email]
Subject: Variable name not recognized

 

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

 

Reply | Threaded
Open this post in threaded view
|

Re: Variable name not recognized

Rick Oliver-3
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