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
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.
SAVE forces a pass of the data.
Art
A...@DrKendall.org
Social Research Consultants
University Park, MD USA
(301) 864-5570
> 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
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
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.
> 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
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!