Discussion:
Variable name contains an illegal character
(too old to reply)
m***@gmail.com
2009-01-29 22:07:27 UTC
Permalink
Hi All,

I'm using SPSS 17, and I'm having problems pasting variable names from
a list (column) in excel to the variable name column in SPSS. I keep
getting the following error message: "Variable name contains an
illegal character". But there are no illegal characters involved!
Further, it will not give me this error message if I try to paste only
a small number of variable names (e.g., 2 names).

This is something that I have routinely used in the past with v. 15
with no problems. Indeed, if I use the same excel file with the same
names, it will paste perfectly with version 15, but will not with
version 17.

Also, this problem doesn't seem to be consistent. Sometimes it will
work ok, others not.

Any thoughts? I'm losing my mind here.

Thanks!

Mary
Bruce Weaver
2009-01-29 23:11:30 UTC
Permalink
Post by m***@gmail.com
Hi All,
I'm using SPSS 17, and I'm having problems pasting variable names from
a list (column) in excel to the variable name column in SPSS.
What is the "variable name column" in SPSS? Do you mean in the
Variable View tab of the Data Editor?
Post by m***@gmail.com
I keep
getting the following error message: "Variable name contains an
illegal character". But there are no illegal characters involved!
But apparently there are.
Post by m***@gmail.com
Further, it will not give me this error message if I try to paste only
a small number of variable names (e.g., 2 names).
This is something that I have routinely used in the past with v. 15
with no problems. Indeed, if I use the same excel file with the same
names, it will paste perfectly with version 15, but will not with
version 17.
Also, this problem doesn't seem to be consistent. Sometimes it will
work ok, others not.
Any thoughts? I'm losing my mind here.
Thanks!
Mary
Perhaps if you explain why you're pasting variable names into SPSS,
someone can suggest an alternative way of accomplishing your goal. If
the point is to rename the variables in an existing file, for example,
you could do that with a RENAME VARIABLES command:

RENAME VARIABLES (list of current names = list of new names).

The list of current names can be pasted via the "Variables" tool (the
button has an icon of a data table with a red question mark beside
it), and the new names can be pasted from Excel.

--
Bruce Weaver
***@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
m***@gmail.com
2009-01-29 23:28:43 UTC
Permalink
Hello Bruce,

Thanks. But I'm afraid that I have just learned from SPSS in a phone
conversation that the problem is the following: "It's a bug."

I like to create variable names in excel because it's efficient. For
example, let's say I have an 18-item scale that assesses need for
cognition. I might like to name these variables nfc1, nfc2,...nfc18.
In excel I can create these names immediately by staring with the
first two names, nfc1 and nfc2, and then dragging down the column.

Likewise, sometimes I collect data online. It's very efficient to copy
the names of the form items in html into excel, then I can quickly
paste them into SPSS.

Let me reiterate, though, this this happens *and there are no illegal
characters* in the variable names. I can further demonstrate this
because I can open a file in SPSS that already has the variables in
place. If I were to want to copy some of the variable names from that
file into a new SPSS file, I get the same error message.

SPSS told me that "they are aware" of the problem and will try to
address it in the next patch.

For the life of me, I don't know why I let go of v. 15. I should have
learned my lesson after seeing v. 16.

Best,

Mary
Post by m***@gmail.com
Hi All,
I'm using SPSS 17, and I'm having problems pasting variable names from
a list (column) in excel to the variable name column in SPSS.
What is the "variable name column" in SPSS?  Do you mean in the
Variable View tab of the Data Editor?
Post by m***@gmail.com
I keep
getting the following error message: "Variable name contains an
illegal character". But there are no illegal characters involved!
But apparently there are.
Post by m***@gmail.com
Further, it will not give me this error message if I try to paste only
a small number of variable names (e.g., 2 names).
This is something that I have routinely used in the past with v. 15
with no problems. Indeed, if I use the same excel file with the same
names, it will paste perfectly with version 15, but will not with
version 17.
Also, this problem doesn't seem to be consistent. Sometimes it will
work ok, others not.
Any thoughts? I'm losing my mind here.
Thanks!
Mary
Perhaps if you explain why you're pasting variable names into SPSS,
someone can suggest an alternative way of accomplishing your goal. If
the point is to rename the variables in an existing file, for example,
RENAME VARIABLES (list of current names = list of new names).
The list of current names can be pasted via the "Variables" tool (the
button has an icon of a data table with a red question mark beside
it), and the new names can be pasted from Excel.
--
Bruce Weaver
"When all else fails, RTFM."
Bruce Weaver
2009-01-30 01:20:18 UTC
Permalink
Post by m***@gmail.com
Hello Bruce,
Thanks. But I'm afraid that I have just learned from SPSS in a phone
conversation that the problem is the following: "It's a bug."
I like to create variable names in excel because it's efficient. For
example, let's say I have an 18-item scale that assesses need for
cognition. I might like to name these variables nfc1, nfc2,...nfc18.
In excel I can create these names immediately by staring with the
first two names, nfc1 and nfc2, and then dragging down the column.
It's also very easy in SPSS syntax. E.g.,

numeric nfc1 to nfc18 (f5.0).
exe.
Post by m***@gmail.com
Likewise, sometimes I collect data online. It's very efficient to copy
the names of the form items in html into excel, then I can quickly
paste them into SPSS.
As I said in my earlier post, you could just as easily paste them
into a RENAME VARIABLES command. But it sounds like you are not a
syntax user.
Post by m***@gmail.com
Let me reiterate, though, this this happens *and there are no illegal
characters* in the variable names. I can further demonstrate this
because I can open a file in SPSS that already has the variables in
place. If I were to want to copy some of the variable names from that
file into a new SPSS file, I get the same error message.
SPSS told me that "they are aware" of the problem and will try to
address it in the next patch.
For the life of me, I don't know why I let go of v. 15. I should have
learned my lesson after seeing v. 16.
Best,
Mary
--
Bruce Weaver
***@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
JKPeck
2009-01-30 03:37:42 UTC
Permalink
Post by m***@gmail.com
Hello Bruce,
Thanks. But I'm afraid that I have just learned from SPSS in a phone
conversation that the problem is the following: "It's a bug."
I like to create variable names in excel because it's efficient. For
example, let's say I have an 18-item scale that assesses need for
cognition. I might like to name these variables nfc1, nfc2,...nfc18.
In excel I can create these names immediately by staring with the
first two names, nfc1 and nfc2, and then dragging down the column.
It's also very easy in SPSS syntax.  E.g.,
numeric nfc1 to nfc18 (f5.0).
exe.
Post by m***@gmail.com
Likewise, sometimes I collect data online. It's very efficient to copy
the names of the form items in html into excel, then I can quickly
paste them into SPSS.
As I said in my earlier post, you could just as easily paste them
into a RENAME VARIABLES command.  But it sounds like you are not a
syntax user.
Post by m***@gmail.com
Let me reiterate, though, this this happens *and there are no illegal
characters* in the variable names. I can further demonstrate this
because I can open a file in SPSS that already has the variables in
place. If I were to want to copy some of the variable names from that
file into a new SPSS file, I get the same error message.
SPSS told me that "they are aware" of the problem and will try to
address it in the next patch.
For the life of me, I don't know why I let go of v. 15. I should have
learned my lesson after seeing v. 16.
Best,
Mary
--
Bruce Weaver
"When all else fails, RTFM."
I just received notification 10 minutes ago that this bug has been
resolved for the next maintenance release. (I can't comment on the
release date for that at this time.)

Regards,
Jon Peck
m***@gmail.com
2009-01-30 14:18:11 UTC
Permalink
Thanks Jon, very helpful. I use syntax extensively, but knowing that
the bug in the program will be resolved will be helpful.

Kind regards,

Mary
f***@lsc.gov.uk
2009-02-02 10:56:26 UTC
Permalink
Presumably if you have a list of variables in one column, say A, you
could add in a formula to another column, eg

="COMPUTE " & A1 & "=-1."

Which you could use to create a block of syntax to create the
variables that way, and then in spss add in a recode for -1 to sysmis.
It would be a way round your current problem.

Fred
Post by m***@gmail.com
Thanks Jon, very helpful. I use syntax extensively, but knowing that
the bug in the program will be resolved will be helpful.
Kind regards,
Mary
a***@gmail.com
2015-04-08 09:26:05 UTC
Permalink
Post by m***@gmail.com
Hi All,
I'm using SPSS 17, and I'm having problems pasting variable names from
a list (column) in excel to the variable name column in SPSS. I keep
getting the following error message: "Variable name contains an
illegal character". But there are no illegal characters involved!
Further, it will not give me this error message if I try to paste only
a small number of variable names (e.g., 2 names).
This is something that I have routinely used in the past with v. 15
with no problems. Indeed, if I use the same excel file with the same
names, it will paste perfectly with version 15, but will not with
version 17.
Also, this problem doesn't seem to be consistent. Sometimes it will
work ok, others not.
Any thoughts? I'm losing my mind here.
Thanks!
Mary
Don't use 'Space' in between variable names and dont start variable name with numbers thats it
sometimes spss do not accept capital letters ... i don't know why.. but it works
d***@gmail.com
2018-05-12 06:22:40 UTC
Permalink
Tks allthewa, it works for me
Andy
2018-10-16 03:18:43 UTC
Permalink
Post by m***@gmail.com
Hi All,
I'm using SPSS 17, and I'm having problems pasting variable names from
a list (column) in excel to the variable name column in SPSS. I keep
getting the following error message: "Variable name contains an
illegal character". But there are no illegal characters involved!
Further, it will not give me this error message if I try to paste only
a small number of variable names (e.g., 2 names).
This is something that I have routinely used in the past with v. 15
with no problems. Indeed, if I use the same excel file with the same
names, it will paste perfectly with version 15, but will not with
version 17.
Also, this problem doesn't seem to be consistent. Sometimes it will
work ok, others not.
Any thoughts? I'm losing my mind here.
Thanks!
Mary
I encountered the same problem. You can try to copy those variable names from excel to text(unformatted) first, then copy from text to spss. It works. Hope it can help all who have the same problem...
CHELSEA BRIDGE WHARF
2018-10-17 21:33:21 UTC
Permalink
I wonder if pasting as plain text into word first and then to paste into SPSS would work? Possibly some formatting is being inserted by excel that SPSS doesn't like? Worth a shot if not tried already
Post by m***@gmail.com
Hi All,
I'm using SPSS 17, and I'm having problems pasting variable names from
a list (column) in excel to the variable name column in SPSS. I keep
getting the following error message: "Variable name contains an
illegal character". But there are no illegal characters involved!
Further, it will not give me this error message if I try to paste only
a small number of variable names (e.g., 2 names).
This is something that I have routinely used in the past with v. 15
with no problems. Indeed, if I use the same excel file with the same
names, it will paste perfectly with version 15, but will not with
version 17.
Also, this problem doesn't seem to be consistent. Sometimes it will
work ok, others not.
Any thoughts? I'm losing my mind here.
Thanks!
Mary
Bruce Weaver
2018-10-17 22:10:15 UTC
Permalink
Post by CHELSEA BRIDGE WHARF
I wonder if pasting as plain text into word first and then to paste into SPSS would work? Possibly some formatting is being inserted by excel that SPSS doesn't like? Worth a shot if not tried already
When using that trick, I always paste into a text editor (e.g., Notepad, EditPad, etc.) rather than into Word.
Andy
2018-10-18 01:24:25 UTC
Permalink
在 2018年10月18日星期四 UTC+8上午5:33:23,CHELSEA BRIDGE WHARF写道:
Post by CHELSEA BRIDGE WHARF
I wonder if pasting as plain text into word first and then to paste into SPSS would work? Possibly some formatting is being inserted by excel that SPSS doesn't like? Worth a shot if not tried already
Post by m***@gmail.com
Hi All,
I'm using SPSS 17, and I'm having problems pasting variable names from
a list (column) in excel to the variable name column in SPSS. I keep
getting the following error message: "Variable name contains an
illegal character". But there are no illegal characters involved!
Further, it will not give me this error message if I try to paste only
a small number of variable names (e.g., 2 names).
This is something that I have routinely used in the past with v. 15
with no problems. Indeed, if I use the same excel file with the same
names, it will paste perfectly with version 15, but will not with
version 17.
Also, this problem doesn't seem to be consistent. Sometimes it will
work ok, others not.
Any thoughts? I'm losing my mind here.
Thanks!
Mary
My friend said word worked. However not in my computer. I guess it depends. But plain text is the best way.
Loading...