Add'_99' at the end of every variable names
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | **************. *** Add _99 to the end of existing variable names. *** Of course existing variable names are assumed to have *** at most 5 characters. **************. DATA LIST LIST /v1 vara varz a2345 a3456. BEGIN DATA. 1 1 1 1 1 END DATA. SAVE OUTFILE='c:\\temp\\mydata.sav'. FLIP. STRING newname(A8). * The last letter of var names having 8 characters are deleted. * unless this would result in a name duplication. COMPUTE newname=CONCAT(RTRIM(case_lbl),'_99'). WRITE OUTFILE='c:\\temp\\rename.sps' / 'RENAME VARIABLE ('case_lbl'='newname').'. Execute. GET FILE='c:\\temp\\mydata.sav'. INCLUDE 'C:\\temp\\rename.sps'. |