LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 21 Sep 2006 10:42:12 -0700
Reply-To:     King Douglas <king_d@swbell.net>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         King Douglas <king_d@swbell.net>
Subject:      Re: renaming variables - deleting the first part of the name
In-Reply-To:  <EBDC7E1030363A4AA4A6DD5E974E7A5002EE5CA9@scorpex02.wickenburg.remuda.com>
Content-Type: text/plain; charset=iso-8859-1

Zina,

RENAME VARIABLES is your friend. This is slightly modified and tested code from Ray Levesque's marvelous site http://www.spsstools.net

Variable names were shortened for backward-compatibility with earlier versions of SPSS that did not permit long variable names.

HTH

King Douglas American Airlines

*(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 rlevesque@videotron.ca on 2002/01/23. DATA LIST FREE / Q101_ofX, Q102_ofY, Q103_cle, Q107_cer, Q108_loa, Q109_opp. BEGIN DATA 85 95 5 87 100 1 90 100 1 25 25 2 END DATA. LIST. SAVE OUTFILE='c:\temp\mydata.sav'. * 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. FLIP. STRING newname(A8). COMPUTE newname=SUBSTR(case_lbl,6). WRITE OUTFILE 'c:\temp\temp.sps' /"RENAME VARIABLE ("case_lbl"="newname").". EXE. GET FILE='c:\temp\mydata.sav'. INCLUDE 'c:\temp\temp.sps'.

Zina Karapetyan <zina.karapetyan@remudaranch.com> wrote: Dear List,

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,

Zina


Back to: Top of message | Previous page | Main SPSSX-L page