Splitting a file into several subfiles

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Splitting a file into several subfiles

Vicent Giner-Bosch
Hello.
 
I want to split a file using one split variable with 18 different values.
But what I specifically want is to split that file into 18 (sub)files, using
that split variable.
 
In your experience, which is the best / fastest way to do that?
 
Thank you in advance.
 
--
Vicent Giner Bosch
 
ESTADIS - Statistics, Data Mining and Optimization Group
 
Polytechnic University of Valencia
 
Department of Applied Statistics, Operations Reseach and Quality
 
Camí de Vera, s/n
 
46022 Valencia, Spain
 
Tel.: +34 96 387 7490  /  +34 96 387 7007 - Ext. 74948  /  +34 630306621
74948
 
Fax: +34 96 387 7499

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Splitting a file into several subfiles

Art Kendall-2
If your variable that you want to split on is "city" and you want
separate output sections containing all the procedures you call for each
city, something like this untested syntax should work.
sort cases by city
split file separate by city.
frequencies . . .
crosstabs . . .
descriptives . . .
split file off.

If you want you want city as the outermost layer in output tables, use
the layered specification rather than separate.
split file layered by city.

Art Kendall
Social Research Consultants

Vicent Giner Bosch wrote:

> Hello.
>
> I want to split a file using one split variable with 18 different values.
> But what I specifically want is to split that file into 18 (sub)files, using
> that split variable.
>
> In your experience, which is the best / fastest way to do that?
>
> Thank you in advance.
>
> --
> Vicent Giner Bosch
>
> ESTADIS - Statistics, Data Mining and Optimization Group
>
> Polytechnic University of Valencia
>
> Department of Applied Statistics, Operations Reseach and Quality
>
> Camí de Vera, s/n
>
> 46022 Valencia, Spain
>
> Tel.: +34 96 387 7490  /  +34 96 387 7007 - Ext. 74948  /  +34 630306621
> 74948
>
> Fax: +34 96 387 7499
>
> ===================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (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
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Splitting a file into several subfiles

Peck, Jon
In reply to this post by Vicent Giner-Bosch
If you just want to perform analyses for each split, use the SPLIT FILES command, as Art recommended.  You can have all the splits in the same table or get separate tables per split.

If you need to make a separate sav file for each split, take a look at the XSAVE transformation command.  You can put that inside DO IF logic.

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Vicent Giner Bosch
Sent: Monday, January 14, 2008 4:16 AM
To: [hidden email]
Subject: [SPSSX-L] Splitting a file into several subfiles
Importance: High

Hello.

I want to split a file using one split variable with 18 different values.
But what I specifically want is to split that file into 18 (sub)files, using
that split variable.

In your experience, which is the best / fastest way to do that?

Thank you in advance.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Splitting a file into several subfiles

Melissa Ives
In reply to this post by Vicent Giner-Bosch
Vincent,

Here is some syntax we use to save files.
Note that when this syntax was created at least (maybe still), you could
not use more than xsave loops in a single do if, so then you just
continue with the rest of the values.

do if yourvar = <value1>.
        xsave outfile='filename1'.
else if yourvar = <value2>.
        xsave outfile='filename2'.
else if yourvar = <value3>.
        xsave outfile='filename3'.
else if yourvar = <value4>.
        xsave outfile='filename4.
else if yourvar = <value5>.
        xsave outfile='filename5'.
else if yourvar = <value6>.
        xsave outfile='filename6'.
else if yourvar = <value7>.
        xsave outfile='filename7'.
else if yourvar = <value8>.
        xsave outfile='filename8'.
else if yourvar = <value9>.
        xsave outfile='filename9'.
else if yourvar = <value10>.
        xsave outfile='filename10'.
end if.
exe.

do if yourvar = <value11>.
        xsave outfile='filename11'.
else if yourvar = <value12>.
        xsave outfile='filename12'.
else if yourvar = <value13>.
        xsave outfile='filename13'.
Etc....
End if.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Peck, Jon
Sent: Monday, January 14, 2008 8:34 AM
To: [hidden email]
Subject: Re: [SPSSX-L] Splitting a file into several subfiles

If you just want to perform analyses for each split, use the SPLIT FILES
command, as Art recommended.  You can have all the splits in the same
table or get separate tables per split.

If you need to make a separate sav file for each split, take a look at
the XSAVE transformation command.  You can put that inside DO IF logic.

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Vicent Giner Bosch
Sent: Monday, January 14, 2008 4:16 AM
To: [hidden email]
Subject: [SPSSX-L] Splitting a file into several subfiles
Importance: High

Hello.

I want to split a file using one split variable with 18 different
values.
But what I specifically want is to split that file into 18 (sub)files,
using that split variable.

In your experience, which is the best / fastest way to do that?

Thank you in advance.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Splitting a file into several subfiles

Raynald Levesque-2
In reply to this post by Vicent Giner-Bosch
Hi

See files 20 and 21 of
http://www.spsstools.net/SampleSyntax.htm#WorkingWithManyFiles

for 2 general macros that do this task (for any number of categorical
values).

--
Raynald Levesque
www.spsstools.net


On Jan 14, 2008 6:15 AM, Vicent Giner Bosch <[hidden email]> wrote:

> Hello.
>
> I want to split a file using one split variable with 18 different values.
> But what I specifically want is to split that file into 18 (sub)files,
> using
> that split variable.
>
> In your experience, which is the best / fastest way to do that?
>
> Thank you in advance.
>
> --
> Vicent Giner Bosch
>
> ESTADIS - Statistics, Data Mining and Optimization Group
>
> Polytechnic University of Valencia
>
> Department of Applied Statistics, Operations Reseach and Quality
>
> Camí de Vera, s/n
>
> 46022 Valencia, Spain
>
> Tel.: +34 96 387 7490  /  +34 96 387 7007 - Ext. 74948  /  +34 630306621
> 74948
>
> Fax: +34 96 387 7499
>
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (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
>

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Splitting a file into several subfiles

Richard Ristow
In reply to this post by Melissa Ives
At 10:11 AM 1/14/2008, Melissa Ives wrote:

>Here is some syntax we use to save files.
>Note that when this syntax was created at least (maybe still), you could
>not use more than xsave loops in a single do if, so then you just
>continue with the rest of the values.

Do you mean, the limit that you can't have more than 10 XSAVE
statements in a single transformation program? If so, yes, that limit
still holds. And you have to do what Melissa's code (I'm not quoting
it) does: write 10 of the output files; close the transformation
program with an EXECUTE; and write 10 more in the next transformation program.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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