Date: Wed, 20 May 2009 17:29:42 +0000
Reply-To: Ruben van den Berg <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Ruben van den Berg <email@example.com>
Subject: SOLVED: Syntax for adding suffix to all variable names in a file
Indeed, that was it! Increasing the length of Newname to (A15) just did the trick!
Thx a lot once again!
Date: Wed, 20 May 2009 13:02:53 -0400
Subject: Re: Syntax for adding suffix to all variable names in a file doesn't work
A guess: the original variable names are longer than you expected.
try something like this untested syntax.
compute howlong = length (RTRIM(Var1)).
frequencies vars = howlong.
Btw, it is often more useful in the long run to use prefixes rather than suffixes.
Suggestion to SPSS. It would be a nice feature for the syntax editor if it expanded abbreviations.
Social Research Consultants
Ruben van den Berg wrote:
I'm sorry to bother the list again but I just can't figure this out:
I'm trying to add the suffix "_R" to all my variable names in the file. For most variables, it works fine but for some the suffix is reduced to just "_" instead of "_R". I don't see any systematic difference between the ones that work and the ones that don't. Unfortunately, this causes the next syntax to break down (some variables ending with "_" are not found because they're specified in the syntax as ending with "_R").
Could anyone please have a look?
TIA once again!!
GET FIL 'RvB_1.sav'.
DATAS NAM RvB_1.
DATAS DEC VarsRvB.
/IF COM=['File Information'] sub=['Variable Information']
DATAS ACT VarsRvB.
*SAV OUT 'VARS_RvB.sav'
STR Suff (A2).
STR Sps (A200).
COMP Sps=CONCAT("REN VAR ",RTRIM(Var1),"=",RTRIM(Newname)).
SAV TRA OUT '2A2_REN_VAR_R.sps'
See all the ways you can stay connected to friends and family
Express yourself instantly with MSN Messenger! Download today it's FREE!