Changing Variable Name in Bulk

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

Changing Variable Name in Bulk

Mark.W.Andrews
Hi All,

 

I am trying to come up with a syntax that will rename variables
sequentially for large (1500+ variable) datasets. I am not too picky
about the new names of the variables so if we could use an SPSS default,
it would be fine (VAR00001, VAR00002, VAR00003). I thought of a
round-about way by exporting the file (comma delineated w/o variable
names) and importing it back in. Is this the easiest way? It just seems
wrong...

 

Any comments would be appreciated,

 

Mark

 

 
Reply | Threaded
Open this post in threaded view
|

Re: Changing Variable Name in Bulk

Oliver, Richard
data list free /firstvar secondvar lastvar.
begin data
1 2 3
end data.
rename variables (firstvar to lastvar=var1 to var3).

*alternatively, you could rename on Save.
save outfile='c:\temp\name.sav'
  /rename (firstvar to lastvar=var1 to var3).



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mark.W.Andrews
Sent: Friday, January 19, 2007 9:27 AM
To: [hidden email]
Subject: Changing Variable Name in Bulk

Hi All,



I am trying to come up with a syntax that will rename variables
sequentially for large (1500+ variable) datasets. I am not too picky
about the new names of the variables so if we could use an SPSS default,
it would be fine (VAR00001, VAR00002, VAR00003). I thought of a
round-about way by exporting the file (comma delineated w/o variable
names) and importing it back in. Is this the easiest way? It just seems
wrong...



Any comments would be appreciated,



Mark