I have a very large data file I am trying to split into more manageable
chunks (without reading the data file multiple times). Is it possible to use XSAVE create different files? I tried: TEMPORARY. SELECT IF id = '111AA'. XSAVE OUTFILE= 'C:\file_111AA.sav'. TEMPORARY. SELECT IF id = '222BB'. XSAVE OUTFILE= 'C:\file_222BB.sav'. EXE. I got this error: >Error # 4425. Command name: TEMPORARY >The TEMPORARY command is misplaced. >This command not executed. The result was two data files file_111AA.sav had the correct data file_222BB.sav had no data (expected since "SELECT IF id = 111AA" was still in effect. Any ideas on how to do this? --jim |
Try DO IF, as in:
data list free /var1. begin data 1 2 3 4 5 6 end data. do if var1 <= 3. xsave outfile='c:\temp\temp1.sav'. else if var1 > 3. xsave outfile='c:\temp\temp2.sav'. end if. execute. In SPSS 15, you'll get some misleading warnings about Xsave in a loop, but you can ignore those. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Marks, Jim Sent: Thursday, April 19, 2007 9:24 AM To: [hidden email] Subject: How to create multiple data files on a single pass (XSAVE?) I have a very large data file I am trying to split into more manageable chunks (without reading the data file multiple times). Is it possible to use XSAVE create different files? I tried: TEMPORARY. SELECT IF id = '111AA'. XSAVE OUTFILE= 'C:\file_111AA.sav'. TEMPORARY. SELECT IF id = '222BB'. XSAVE OUTFILE= 'C:\file_222BB.sav'. EXE. I got this error: >Error # 4425. Command name: TEMPORARY >The TEMPORARY command is misplaced. >This command not executed. The result was two data files file_111AA.sav had the correct data file_222BB.sav had no data (expected since "SELECT IF id = 111AA" was still in effect. Any ideas on how to do this? --jim |
In reply to this post by Marks, Jim
Jim,
Add EXE. command before the second TEMPOPRARY. TEMPORARY. SELECT IF id = '111AA'. XSAVE OUTFILE= 'C:\file_111AA.sav'. EXE. TEMPORARY. SELECT IF id = '222BB'. XSAVE OUTFILE= 'C:\file_222BB.sav'. EXE. Greetings Frederic Frederic Villamayor, BS Researcher Biostatistics Unit Juan de Sada, 32 08028 Barcelona Tel +34 935093236 Fax +34 934112764 [hidden email] http://www.ferrergrupo.com Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información confidencial, siendo para uso exclusivo del destinatario, quedando prohibida su divulgación, copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración. This message and its annexed files may contain confidential information which is exclusively for the use of the addressee. It is strictly forbidden to distribute copies to third parties without the explicit permission of the sender. If you receive this message by mistake, please notify it to the sender and make sure to delete it. Thank you for your kind cooperation. "Marks, Jim" <[hidden email]> Enviado por: "SPSSX(r) Discussion" <[hidden email]> 19/04/2007 16:23 Por favor, responda a "Marks, Jim" <[hidden email]> Para [hidden email] cc Asunto [SPSSX-L] How to create multiple data files on a single pass (XSAVE?) I have a very large data file I am trying to split into more manageable chunks (without reading the data file multiple times). Is it possible to use XSAVE create different files? I tried: TEMPORARY. SELECT IF id = '111AA'. XSAVE OUTFILE= 'C:\file_111AA.sav'. TEMPORARY. SELECT IF id = '222BB'. XSAVE OUTFILE= 'C:\file_222BB.sav'. EXE. I got this error: >Error # 4425. Command name: TEMPORARY >The TEMPORARY command is misplaced. >This command not executed. The result was two data files file_111AA.sav had the correct data file_222BB.sav had no data (expected since "SELECT IF id = 111AA" was still in effect. Any ideas on how to do this? --jim |
That would force two data passes, and I think the object is to avoid that. Using DO IF avoids that pitfall:
Do if id='111AA'. Xsave outfile='c:\file_111AAA.sav'. Else if id='222BB'. Xsave outfile='c:\file_222BB.sav'. End if. Execute. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Frederic Villamayor Forcada Sent: Thursday, April 19, 2007 9:46 AM To: [hidden email] Subject: Re: How to create multiple data files on a single pass (XSAVE?) Jim, Add EXE. command before the second TEMPOPRARY. TEMPORARY. SELECT IF id = '111AA'. XSAVE OUTFILE= 'C:\file_111AA.sav'. EXE. TEMPORARY. SELECT IF id = '222BB'. XSAVE OUTFILE= 'C:\file_222BB.sav'. EXE. Greetings Frederic Frederic Villamayor, BS Researcher Biostatistics Unit Juan de Sada, 32 08028 Barcelona Tel +34 935093236 Fax +34 934112764 [hidden email] http://www.ferrergrupo.com Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información confidencial, siendo para uso exclusivo del destinatario, quedando prohibida su divulgación, copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración. This message and its annexed files may contain confidential information which is exclusively for the use of the addressee. It is strictly forbidden to distribute copies to third parties without the explicit permission of the sender. If you receive this message by mistake, please notify it to the sender and make sure to delete it. Thank you for your kind cooperation. "Marks, Jim" <[hidden email]> Enviado por: "SPSSX(r) Discussion" <[hidden email]> 19/04/2007 16:23 Por favor, responda a "Marks, Jim" <[hidden email]> Para [hidden email] cc Asunto [SPSSX-L] How to create multiple data files on a single pass (XSAVE?) I have a very large data file I am trying to split into more manageable chunks (without reading the data file multiple times). Is it possible to use XSAVE create different files? I tried: TEMPORARY. SELECT IF id = '111AA'. XSAVE OUTFILE= 'C:\file_111AA.sav'. TEMPORARY. SELECT IF id = '222BB'. XSAVE OUTFILE= 'C:\file_222BB.sav'. EXE. I got this error: >Error # 4425. Command name: TEMPORARY >The TEMPORARY command is misplaced. >This command not executed. The result was two data files file_111AA.sav had the correct data file_222BB.sav had no data (expected since "SELECT IF id = 111AA" was still in effect. Any ideas on how to do this? --jim |
In reply to this post by Frederic Villamayor Forcada
At 10:46 AM 4/19/2007, Frederic Villamayor Forcada wrote:
>At 10:23 AM 4/19/2007, Marks, Jim wrote: >>Is it possible to use XSAVE create different files? I tried: >> >>TEMPORARY. >>SELECT IF id = '111AA'. >>XSAVE OUTFILE= 'C:\file_111AA.sav'. >> >>TEMPORARY. >>SELECT IF id = '222BB'. >>XSAVE OUTFILE= 'C:\file_222BB.sav'. >>EXE. > >Add EXE. command before the second TEMPOPRARY. I'm afraid that this is wrong. That is, although it will give you the files you want, it takes a complete pass through the original data for each one. So, it loses all of the savings from XSAVE. Richard Oliver's advice, to use DO IF logic, is exactly the technique to get the effect you want. As you're hoping, it will save a lot of time. The "execute." after his DO IF structure *is* necessary; this is one of the (fairly few) instances where EXECUTE is truly useful. (It may not matter, and you may not be able to do it, but you'll save a little more time if the file you're reading and the files you're writing are on separate disks.) |
In reply to this post by Oliver, Richard
Sweet!
Now my computer will have something to do this weekend :~) Thanks Richard (and Richard). --jim -----Original Message----- From: Oliver, Richard [mailto:[hidden email]] Sent: Thursday, April 19, 2007 9:41 AM To: Marks, Jim; [hidden email] Subject: RE: How to create multiple data files on a single pass (XSAVE?) Try DO IF, as in: data list free /var1. begin data 1 2 3 4 5 6 end data. do if var1 <= 3. xsave outfile='c:\temp\temp1.sav'. else if var1 > 3. xsave outfile='c:\temp\temp2.sav'. end if. execute. In SPSS 15, you'll get some misleading warnings about Xsave in a loop, but you can ignore those. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Marks, Jim Sent: Thursday, April 19, 2007 9:24 AM To: [hidden email] Subject: How to create multiple data files on a single pass (XSAVE?) I have a very large data file I am trying to split into more manageable chunks (without reading the data file multiple times). Is it possible to use XSAVE create different files? I tried: TEMPORARY. SELECT IF id = '111AA'. XSAVE OUTFILE= 'C:\file_111AA.sav'. TEMPORARY. SELECT IF id = '222BB'. XSAVE OUTFILE= 'C:\file_222BB.sav'. EXE. I got this error: >Error # 4425. Command name: TEMPORARY >The TEMPORARY command is misplaced. >This command not executed. The result was two data files file_111AA.sav had the correct data file_222BB.sav had no data (expected since "SELECT IF id = 111AA" was still in effect. Any ideas on how to do this? --jim |
Free forum by Nabble | Edit this page |