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 (February 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 29 Feb 2008 04:46:12 -0800
Reply-To:     Albert-jan Roskam <fomcl@yahoo.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Albert-jan Roskam <fomcl@yahoo.com>
Subject:      Re: Multiple SAVE TRANSLATE files
Comments: To: Dennis Deck <DDeck@rmccorp.com>
In-Reply-To:  <EFCF16377594714C9B2B3A8CFC31615D01CF78F7@svrmail.RMC.local>
Content-Type: text/plain; charset=iso-8859-1

Hi Dennis,

It's a pitty that there is no such thing as XSAVE TRANSLATE.

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'. temporary. 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. !doend. !enddefine.

set mprint = on. save_it.

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 about this?

Cheers!! Albert-Jan

--- 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 > ddeck@rmccorp.com > > ====================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. http://www.yahoo.com/r/hs

===================== 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


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