Date: Fri, 29 Feb 2008 04:46:12 -0800
Reply-To: Albert-jan Roskam <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Albert-jan Roskam <email@example.com>
Subject: Re: Multiple SAVE TRANSLATE files
Content-Type: text/plain; charset=iso-8859-1
It's a pitty that there is no such thing as XSAVE
define save_it ().
get file = 'd:\temp\real_sourcefile.sav'.
save outfile = 'd:\temp\copy_sourcefile.sav'.
!do !cnt = 1 !to 400.
get file = 'd:\temp\copy_sourcefile.sav'.
select if byvar ne !cnt.
xsave outfile = 'd:\temp\copy_sourcefile.sav'.
select if byvar = !cnt.
save translate outfile =
!quote(!concat('d:\temp\outfile_',!cnt,'.xls')) / type
= xls / version = 8 / fieldnames.
set mprint = on.
I didn't test this. First a copy of the original file
is made. That copy is overwritten by a file that does
not meet the by-variable condition (one of your 400
file parts), so the next loop will use a smaller file.
Second, the part of the file that does meet the
condition is saved as an xls file (assuming that
that's what you need).
It would be neater though to create Python script that
does this job. Perhaps the CSV module could be used
for this. I bet that would be a lot faster. But I am
not sure whether f_in = spss.Submit("get file =
'd:\temp\real_sourcefile.sav'.") would be an iterable
variable. Perhaps somebody else on this list has ideas
--- Dennis Deck <DDeck@rmccorp.com> wrote:
> I am trying to create a program to parse a big input
> file and save multiple (about 400) school level
> files using SAVE TRANSLATE.
> I would like to avoid the tedious (and error prone)
> task of writing 400 sets of commands to do this.
> I have constructed various macros but cannot seem to
> get syntax that works.
> I keep running into limitations in the use of SAVE
> TRANSLATE or other problems within the macros.
> Any suggestions?
> Dennis Deck, PhD
> RMC Research Corporation
> 111 SW Columbia Street, Suite 1200
> Portland, Oregon 97201-5843
> voice: 503-223-8248 x715
> voice: 800-788-1887 x715
> fax: 503-223-8248
> ====================To manage your subscription to
> SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no
> body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send
> the command
> INFO REFCARD
Never miss a thing. Make Yahoo your home page.
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command