adding extensions to variable names

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

adding extensions to variable names

msherman
Dear List: Here is quick question (so I think). I have a bunch of variables in excel and some are repeated and thus have an extension of _A (the second sequence of surveys) and then I have the next data file that does not have the extension of _A and I want to add _A to all of the variables in the next data file within spss. Is there a quick way of doing this within spss. thanks,



Martin F. Sherman, Ph.D.
Professor of Psychology
Director of Masters Education, Thesis Track
4501 North Charles Street
Psychology Department
222 B Beatty Hall
Baltimore, MD 21210

Phone: 410 617-2417
Fax: 410 617-5341
email: [hidden email]

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: adding extensions to variable names

Peck, Jon
The TO convention in SPSS can be used with RENAME VARIABLES, but it would only work on the output side if the root names were all the same and you wanted to add a numeric suffix.

The following short Python program does what you want.  It generates the appropriate RENAME VARIABLES command and runs it.  Of course it requires the Python plug-in,

begin program.
import spss, spssaux

oldvariables = spssaux.VariableDict().variables
newvariables = [v + "_A" for v in oldvariables]
spss.Submit("""RENAME VARIABLES (%s =
 %s).""" %
  (" ".join(oldvariables), " ".join(newvariables)))
end program.

HTH,
Jon Peck
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Martin Sherman
Sent: Thursday, February 05, 2009 5:03 PM
To: [hidden email]
Subject: [SPSSX-L] adding extensions to variable names

Dear List: Here is quick question (so I think). I have a bunch of variables in excel and some are repeated and thus have an extension of _A (the second sequence of surveys) and then I have the next data file that does not have the extension of _A and I want to add _A to all of the variables in the next data file within spss. Is there a quick way of doing this within spss. thanks,



Martin F. Sherman, Ph.D.
Professor of Psychology
Director of Masters Education, Thesis Track
4501 North Charles Street
Psychology Department
222 B Beatty Hall
Baltimore, MD 21210

Phone: 410 617-2417
Fax: 410 617-5341
email: [hidden email]

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

stop sending me the message please

Pang-Pang
stop sending me the message please, i mean i do not want subscription again. Thank you.


Yahoo!香港提供網上安全攻略,教你如何防範黑客!了解更多
Reply | Threaded
Open this post in threaded view
|

Re: stop sending me the message please

Richard Ristow
At 09:39 AM 2/6/2009, Pang-Pang wrote:

>stop sending me the message please, i mean i do not want subscription again.

It looks like (somehow) you aren't getting the sig with the
instructions -- normally it's appended to all traffic from SPSSX-L. Here it is:

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: stop sending me the message please

ViAnn Beadle
We get these annoying messages because the folks sending them don't even
read the contents of the email they are receiving. Maybe others are like
me--I rarely look at signatures.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Richard Ristow
Sent: Friday, February 06, 2009 1:21 PM
To: [hidden email]
Subject: Re: stop sending me the message please

At 09:39 AM 2/6/2009, Pang-Pang wrote:

>stop sending me the message please, i mean i do not want subscription
again.

It looks like (somehow) you aren't getting the sig with the
instructions -- normally it's appended to all traffic from SPSSX-L. Here it
is:

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD