Date: Thu, 21 Sep 2006 10:42:12 -0700
Reply-To: King Douglas <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: King Douglas <email@example.com>
Subject: Re: renaming variables - deleting the first part of the name
Content-Type: text/plain; charset=iso-8859-1
RENAME VARIABLES is your friend. This is slightly modified and tested code from Ray Levesque's marvelous site
Variable names were shortened for backward-compatibility with earlier versions of SPSS that did not permit long variable names.
*(Q) I am about to merge three huge data sets. Every dataset contains hundreds of
vars. The var names are identical except for the prefix "tn". For example,
var names of dataset no.1 start with"t1" t1abc, t1xyz, t1sps....
* var names of dataset no.2 start with"t2" t2abc, t2xyz, t2sps....
* var names of dataset no.3 start with"t3" t3abc, t3xyz, t3sps....
* How can I rename the vars of datsets nos. 2 and 3, so that they will begin
with "t1", e.g. "t1abc" (former "t3abc"), too?
*(A) Posted to SPSSX-L by firstname.lastname@example.org on 2002/01/23.
DATA LIST FREE
/ Q101_ofX, Q102_ofY, Q103_cle, Q107_cer, Q108_loa, Q109_opp.
85 95 5 87 100 1
90 100 1 25 25 2
* Be sure you have a backup copy of your data file before running this.
* Next lines ensures no error will occur when there are more than 32,000 variables
in the data file (Thanks to H. Maletta for this suggestion).
N OF CASES 1.
WRITE OUTFILE 'c:\temp\temp.sps'
/"RENAME VARIABLE ("case_lbl"="newname").".
Zina Karapetyan <email@example.com> wrote:
I have a file with over a 100 variables named Q101_ofcsp, Q102_ofceq,
Q103_clean, Q107_cereq, Q108_load, Q109_oppor, Q110_descr, etc. I need
to get rid of the QXXX_ part for every variable; that is to rename
Q101_ofcsp to ofcsp, etc. Is there a way to do this in SPSS besides
using RENAME VARIABLES? Any help would be greatly appreciated.
Thank you very much,