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 (January 1997)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 9 Jan 1997 10:48:13 EST
Reply-To:     Gloria Edwards <gsedward@hamlet.uncg.edu>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
Comments:     Resent-From: peter homel <HOMEL@SNYBKSAC>
Comments:     Originally-From: peter homels <homel@SACC.HSCBKLYN.EDU>
From:         peter homel <HOMEL@SACC.HSCBKLYN.EDU>
Subject:      renaming multiple variables

This may not be feasible for Gloria Edward's problem, but I have found a quick and not so dirty way of renaming variables from multiple files where there are duplicate variable names. The trick is to merge the files first in a program that does allow for duplicate "variable names". Thie can be done, for example, in Excel (using copy and paste, say).

When you bring the Excel file into SPSS, SPSS will automatically rename duplicate variable names by adding a numeral to the duplicate variable names. For example, say you bring in an Excel file which contains the following column names: X1 X2 X11 X1 X2 X11 X1 X2 X11. SPSS will rename these as X1 X2 X11 X12 X21 X111 X13 X22 X112. It can be seen that SPSS simply adds a numeral that will make the renamed variable unique (e.g., X2 -> X21 in the first duplicate, X2 -> X22 in the second duplicate). SPSS always checks to see whether renaming the variable will result in another duplication. Since X11 already exists, X1 -> X12 in the first duplicate while X1 -> X13 in the second duplicate.

This tends to work fairly well with variable names that do not end with numerals. SPSS will truncate variable names before adding numerals in order to keep within the eight character limit for variables names. Working with variable names that already end in numerals may make it confusing you to tell which ones come from which file (although that can be done based on the order of the variables in the file).

Another problem that precludes using this method for Gloria Edwards data is that (as far as I know) Excel is limited to 255 (256?0 columns which would not be enough for what Gloria is doing. Anyway, this method works fine for small files with not too many variables.

PETER HOMEL PHD HEALTH SCIENCE CENTER BROOKLYN STATE UNIVERSITY OF NEW YORK 450 CLARKSON AVENUE BOX 7 BROOKLYN, NY 11203-2098

EMAIL: HOMEL@SACC.HSCBKLYN.EDU HOMEL@SNYBKSAC.BITNET

TEL: (718) 270-7424 FAX: (718) 270-7461

MOTTO: STATISTICS DON'T LIE!(PEOPLE DO!)

----------------------------Original message---------------------------- I have a client who wants to merge three datasets. The problem is that the datasets have duplicate variable names (e.g., v1-v225) that represent different things in each dataset. Therefore, the variables need to be renamed before merging.

Is there a way to rename multiple variables in SPSS without specifying each variable individually? The datasets are so large that individual renames would be extremely cumbersome, but the menu options in SPSS Win 7.0 didn't appear to provide a work around. Can we do this with syntax

Any help would be appreciated.

Thanks,

Gloria Edwards Instructional and Research Computing 235 Bryan Building UNC Greensboro (910)334-5350


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