Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what is xsave - exactly

283 views
Skip to first unread message

Feyo

unread,
Mar 18, 2005, 11:02:12 AM3/18/05
to
Seems like everyone knows that answer to this but me.....does xsave
save a datafile to memory, sort of like a recordset in VB or VBA? If
not, what are it's advantages over a traditional SAVE command. Thanks
for your help.

Carl Kaufmann

unread,
Mar 18, 2005, 1:02:14 PM3/18/05
to

SAVE and XSAVE do exactly the same thing. The difference is when;
SAVE executes immediately. XSAVE waits until the next (implied)
EXECUTE command.

--
EAC Liar, Damned Liar, and Statistician
alt.atheist #1966
"Statistical thinking will one day be as necessary for efficient
citizenship as the ability to read and write." - H.G. Wells

Feyo

unread,
Mar 18, 2005, 1:08:02 PM3/18/05
to
I read that in the syntax guide, but don't see how it's so wonderful.
When would you want to use XSAVE versus SAVE and vice versa?

Michael....@colostate.edu

unread,
Mar 18, 2005, 1:23:20 PM3/18/05
to
Feyo <david.k...@ddiworld.com> wrote:
> I read that in the syntax guide, but don't see how it's so wonderful.
> When would you want to use XSAVE versus SAVE and vice versa?

XSAVE is treated like a transformation, in that it can be used
(quite effectively) inside of control structures, such as
the following way in which one can create separate files
for different groups:

do if group eq 1 .
save outfile = 'group1.sav' .
else if group eq 2 .
save outfile = 'group2.sav' .
....
end if .


--
=-=-=-=-=-=-=-=-=-==-=-=-=
Mike Lacy, Ft Collins CO 80523
Clean out the 'junk' to email me.

Art Kendall

unread,
Mar 18, 2005, 2:05:02 PM3/18/05
to
Also, at least on some platforms, it can be used to save data passes
when you have very large data files. (e.g. Census).
When the first data-passing command is encountered, and if there is
nothing after it, SPSS does not create binary scratch files.

SAVE forces a pass of the data.

Art
A...@DrKendall.org
Social Research Consultants
University Park, MD USA
(301) 864-5570

Bruce Weaver

unread,
Mar 18, 2005, 4:36:01 PM3/18/05
to
Michael....@colostate.edu wrote:

> Feyo <david.k...@ddiworld.com> wrote:
>
>>I read that in the syntax guide, but don't see how it's so wonderful.
>>When would you want to use XSAVE versus SAVE and vice versa?
>
>
> XSAVE is treated like a transformation, in that it can be used
> (quite effectively) inside of control structures, such as
> the following way in which one can create separate files
> for different groups:
>
> do if group eq 1 .
> save outfile = 'group1.sav' .
> else if group eq 2 .
> save outfile = 'group2.sav' .
> ....
> end if .
>
>

I think Mike meant to have XSAVE there, not SAVE. I.e.,

do if group eq 1 .

XSAVE outfile = 'group1.sav' .


else if group eq 2 .

XSAVE outfile = 'group2.sav' .
....
end if .


--
Bruce Weaver
bwe...@lakeheadu.ca
www.angelfire.com/wv/bwhomedir

neila...@msn.com

unread,
Mar 22, 2005, 12:46:57 PM3/22/05
to
Ah Grasshopper....;-) When you can snatch these data back from the
bitbucket...
Actually, XSAVE is a godsend transformation which allows the following
type of
data transformation/restructuring without saving N (5 in this case)
intermediate files.
I use it extensively and don't know how other people get along without
it. It has
many other nifty applications. Anytime you want to dump data into a
SPSS file format
you can save a data pass with XSAVE. The examples Mike and Bruce
provided are
examples of using XSAVE to break a file into Multiple files (up to 9
may be done at once)
HTH, Neila

DATA LIST FREE / X1 X2 X3 X4 X5 Y1 Y2 Y3 Y4 Y5.
BEGIN DATA.
3 2 1 7 3 6 7 1 2 8
6 3 7 8 1 3 6 8 7 1
2 6 3 8 7 1 6 8 7 1
6 3 8 7 6 3 8 7 1 2
6 3 8 7 1 6 7 8 1 2
6 3 7 8 1 6 8 3 7 6
END DATA.
VECTOR VX = X1 TO X5 / VY = Y1 TO Y5.
COMPUTE CASEID=$CASENUM.
LOOP REP=1 TO 5.
+ DO REPEAT VEC = VX VY / VAR= X Y.
+ COMPUTE VAR= VEC(REP).
+ END REPEAT.
+ XSAVE OUTFILE "C:\TEMP\LongAndSkinny.sav" / KEEP CASEID REP X Y.
END LOOP.
EXE.
GET FILE "C:\TEMP\LongAndSkinny.sav".

LIST.

CASEID REP X Y

1.00 1.00 3.00 6.00
1.00 2.00 2.00 7.00
1.00 3.00 1.00 1.00
1.00 4.00 7.00 2.00
1.00 5.00 3.00 8.00
2.00 1.00 6.00 3.00
2.00 2.00 3.00 6.00
2.00 3.00 7.00 8.00
2.00 4.00 8.00 7.00
2.00 5.00 1.00 1.00
3.00 1.00 2.00 1.00
3.00 2.00 6.00 6.00
3.00 3.00 3.00 8.00
3.00 4.00 8.00 7.00
3.00 5.00 7.00 1.00
4.00 1.00 6.00 3.00
4.00 2.00 3.00 8.00
4.00 3.00 8.00 7.00
4.00 4.00 7.00 1.00
4.00 5.00 6.00 2.00
5.00 1.00 6.00 6.00
5.00 2.00 3.00 7.00
5.00 3.00 8.00 8.00
5.00 4.00 7.00 1.00
5.00 5.00 1.00 2.00
6.00 1.00 6.00 6.00
6.00 2.00 3.00 8.00
6.00 3.00 7.00 3.00
6.00 4.00 8.00 7.00
6.00 5.00 1.00 6.00


Number of cases read: 30 Number of cases listed: 30

Feyo

unread,
Mar 23, 2005, 1:27:38 PM3/23/05
to
Just to clarify.....the above syntax saves the set of transformations
for
each iteration of the loop. So, does XSAVE sort of use an ADD FILES
command to append each successive set of data. Is this always the case?

Two bullets in the syntax guide give me pause:
· Maximum 10 XSAVE commands are allowed in a session.
· Multiple XSAVE commands writing to the same file are not permitted.

So, you could only have had a loop with 10 iternations, no more? What
is considered a session? The second bullet refers to a seperate
instance of XSAVE, for example, an instance outside of the loop. Right?

Thanks.

Richard Ulrich

unread,
Mar 23, 2005, 1:46:47 PM3/23/05
to
On 23 Mar 2005 10:27:38 -0800, "Feyo" <david.k...@ddiworld.com>
wrote:

> Just to clarify.....the above syntax saves the set of transformations
> for
> each iteration of the loop. So, does XSAVE sort of use an ADD FILES
> command to append each successive set of data. Is this always the case?

No, I would not say "like an ADD FILE." - It writes to a NEW file.
I has the possibility of writing several times to the file
while processing one line of the original file.

Or, if you have several XSAVE-lines, you can write
to several files while reading one line of the original.


>
> Two bullets in the syntax guide give me pause:
> · Maximum 10 XSAVE commands are allowed in a session.
> · Multiple XSAVE commands writing to the same file are not permitted.
>
> So, you could only have had a loop with 10 iternations, no more? What

No.
A "loop" with one XSAVE has exactly one XSAVE, writing to
one file. A "loop" does not generate new lines in the way
that a DO REPEAT does; and you can't put XSAVE in a
DO REPEAT structure.


> is considered a session? The second bullet refers to a seperate
> instance of XSAVE, for example, an instance outside of the loop. Right?
>

Hope that helps.


--
Rich Ulrich, wpi...@pitt.edu
http://www.pitt.edu/~wpilib/index.html

neila...@msn.com

unread,
Mar 23, 2005, 2:00:19 PM3/23/05
to
>So, does XSAVE sort of use an ADD FILES command to append each
>successive set of data.

Probably not! I would imagine SPSS uses something fairly low level in
the
SPSSIO32.dll (spssOpenAppend, spssWholeCaseOut ) maybe even lower than
that (the app is staring the naked bits in the face, maybe no need for
the API).

> Is this always the case?

I don't understand the question.

>Two bullets in the syntax guide give me pause:

One bullet especially the silver kind usually stops me dead in my
tracks, until
I crash my way out of the morgue again! They are really getting tired
of the
broken doors and shattered glass every damned full moon;-))

>· Maximum 10 XSAVE commands are allowed in a session.

Well, you can party on with XSAVE til the pigs fly and the bulls
come home pregnant.

Except, no more than 10 separate XSAVES per transformation step
-separate meaning to a unique file-.

>· Multiple XSAVE commands writing to the same file are not permitted.


Once the file is closed, Get file -different file-, New FILE, It is
fair game!!!
So, within the same transformation block prior to an EXE or other
procedure.

>What is considered a session?

I have never quite figured that one out. Probably an anachronism going
back to
batch processing days and the SPSS publications group never updated the
docs.
I simply don't worry about it. I have enough gray hair as it is.
HTH,
Neila

BTW, I learned most of this through trial and error/experimentation!!!
Don't be put off by documented limitations! Try to break the 'rules'.
Sometimes it works!

0 new messages