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 (May 2009)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 20 May 2009 17:29:42 +0000
Reply-To:     Ruben van den Berg <ruben_van_den_berg@hotmail.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Ruben van den Berg <ruben_van_den_berg@hotmail.com>
Subject:      SOLVED: Syntax for adding suffix to all variable names in a file
              doesn't work
In-Reply-To:  <4A1437BD.2060304@DrKendall.org>
Content-Type: multipart/alternative;

Indeed, that was it! Increasing the length of Newname to (A15) just did the trick!

Thx a lot once again!

Kind regards,

Ruben

Date: Wed, 20 May 2009 13:02:53 -0400 From: Art@DrKendall.org Subject: Re: Syntax for adding suffix to all variable names in a file doesn't work To: SPSSX-L@LISTSERV.UGA.EDU

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.

Art Kendall Social Research Consultants

Ruben van den Berg wrote:

Dear all, 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. OMS /SEL TAB /IF COM=['File Information'] sub=['Variable Information'] /DES FOR=SAV OUTFILE=VarsRvB VIE=NO. DISP VAR. OMSEND. DATAS ACT VarsRvB. *SAV OUT 'VARS_RvB.sav' */COM. *SHOW DIR. STR Suff (A2). STR Newname(A11). STR Sps (A200). COMP Suff="_R". COMP Newname=CONCAT(RTRIM(Var1),Suff). COMP Sps=CONCAT("REN VAR ",RTRIM(Var1),"=",RTRIM(Newname)). EXE. SAV TRA OUT '2A2_REN_VAR_R.sps' /TYP TAB /KEE Sps /REP.

See all the ways you can stay connected to friends and family _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


[text/html]


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