Save outfile command after Reordering variables

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

Save outfile command after Reordering variables

Sanchez, Edgar
Greetings:

 

            In a previous post to the group I asked about reordering
variables in a dataset (among other things which I have since worked
out, many thanks to the group). I am still stuck on the reordering of
variables. I had initially had a save command after my access import
(*save outputfile='R:\EDUCATE\PIIE\_Current or Completed Projects\9323
D3M Data Driven Decision Making\Surveys\Analysis\D3M Q1 to Q19.sav'.)
and another after all my manipulations (see below). I have a lot of
variables that get out of order due to many computes etc. Now when I
have both save statements the open file is saved with the correct name
but the reordering accomplished through the keep in the second is not
performed. Now if I comment out the first one the open file is not saved
with proper filename but if I open that created file it has the proper
variable order. How can I get it to save the open file with the proper
name AND actually reorder my variables? Many Thanks!

 

SAVE OUTFILE='R:\EDUCATE\PIIE\_Current or Completed Projects\9323 D3M
Data Driven Decision Making\Surveys\Analysis\D3M Q1 to Q19.sav'

            /KEEP=District Q_1_1_0_0        Q_1_2_0_0        Q_2_0_0_0
Q_3_0_0_0        Q_4_1_1_0        Q_4_1_2_0             Q_4_1_3_0
Q_4_1_4_0        Q_4_2_1_0

                        Q_4_2_2_0        Q_4_2_3_0        Q_4_2_4_0
Q_4_3_1_0        Q_4_3_2_0        Q_4_3_3_0        Q_4_3_4_0
Q_4_4_1_0        Q_4_4_2_0

                        Q_4_4_3_0        Q_4_4_4_0        Q_4_5_1_0
Q_4_5_2_0        Q_4_5_3_0        Q_4_5_4_0        Q_5_1_1_0
Q_5_1_2_0        Q_5_1_3_0

                        Q_5_2_1_0        Q_5_2_2_0        Q_5_2_3_0
Q_5_3_1_0        Q_5_3_2_0        Q_5_3_3_0        Q_5_4_1_0
Q_5_4_2_0        Q_5_4_3_0

                        Q_5_5_1_0        Q_5_5_2_0        Q_5_5_3_0
Q_6_1   Q_6_1_6_0        Q_6_2   Q_6_2_6_0        Q_6_3
Q_6_3_6_0

                        Q_6_4_1_0        Q_6_4_2_0        Q_6_4_3_0
Q_6_4_4_0        Q_6_4_5_0        Q_7_1   Q_7_1_6_0             Q_7_2
Q_7_2_6_0

                        Q_7_3   Q_7_3_6_0        Q_7_4_1_0
Q_7_4_2_0        Q_7_4_3_0        Q_7_4_4_0        Q_7_4_5_0
Q_8_1_0_0        Q_8_10_0_0

                        Q_8_11_0_0      Q_8_12_0_0      Q_8_13_0_0
Q_8_2_0_0        Q_8_3_0_0        Q_8_4_0_0        Q_8_5_0_0
Q_8_6_0_0        Q_8_7_0_0

                        Q_8_8_0_0        Q_8_9_0_0        Q_9_1_0_0
Q_9_2_0_0        Q_9_3_0_0        Q_9_4_0_0        Q_9_5_0_0
Q_9_6_0_0        Q_9_7_0_0

                        Q_9_8_0_0        Q_9_9_0_0        Q_9_10_0_0
Q_9_11_0_0      Q_9_12_0_0      Q_9_13_0_0      Q_10_1_1_0
Q_10_1_2_0      Q_10_1_3_0

                        Q_10_1_4_0      Q_10_1_5_0      Q_10_1_6_0
Q_10_2_1_0      Q_10_2_2_0      Q_10_2_3_0      Q_10_2_4_0
Q_10_2_5_0      Q_10_2_6_0

                        Q_10_3_1_0      Q_10_3_2_0      Q_10_3_3_0
Q_10_3_4_0      Q_10_3_5_0      Q_10_3_6_0      Q_10_4_1_0
Q_10_4_2_0      Q_10_4_3_0

                        Q_10_4_4_0      Q_10_4_5_0      Q_10_4_6_0
Q_10_5_0_0      Q_10_5_1_0      Q_10_5_2_0      Q_10_5_3_0
Q_10_5_4_0      Q_10_5_5_0

                        Q_10_5_6_0      Q_11    Q_12_1_0_0
Q_12_2_0_0      Q_12_3             Q_12_3_5_0      Q_12_4_1_0
Q_12_4_2_0      Q_12_4_3_0

                        Q_12_4_4_0      Q_12_4_5_0      Q_13_1
Q_13_1_3_0      Q_13_2_0_0      Q_13_3_1_0      Q_13_3_2_0
Q_13_3_3_0      Q_13_3_4_0

                        Q_13_3_5_1      Q_13_3_5_2      Q_13_4_1_0
Q_13_4_2_0      Q_14_1_1_0      Q_14_1_2_0      Q_14_1_3_0
Q_14_2_1_0      Q_14_2_2_0

                        Q_14_2_3_0      Q_14_3_1_0      Q_14_3_2_0
Q_15_1             Q_15_2             Q_15_3             Q_15_4_0_0
Q_15_4             Q_16_0_0_0

                        Q_17_0_0_0      Q_18_1_0_0      Q_18_2_0_0
Q_18_3_0_0      Q_19_1_0_0      Q_19_2_0_0             Q_19_3_0_0.

 

 

Edgar I Sanchez, Ph.D.

 

[hidden email] <mailto:[hidden email]>

http://www.apqceducation.org/ <http://www.apqceducation.org/>

 

====================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: Save outfile command after Reordering variables

Marks, Jim
Edgar:

When you use /KEEP or /DROP in a save command, the working file is not
affected, but a different version is written to disk.

Two solutions:

1) Immediately after SAVE (with /KEEP) run:

GET FILE = 'your file.sav'.

*** test case.

data list free /id v1 v3 v2.
begin data
1 2 3 4
2 3 6 7
end data.

save outfile = 'c:\spss-test1.sav'.

comp v4 = v1+v2.
exe.

save outfile = 'c:\spss-test1.sav'
  /keep id v1 v2 v3 v4.

get file  = 'c:\spss-test1.sav'.

2) Use add files to reorganize the data, and use SAVE without the keep.

**** test case.
data list free /id v1 v3 v2.
begin data
1 2 3 4
2 3 6 7
end data.

save outfile = 'c:\spss-test1.sav'.

comp v4 = v1+v2.
exe.

ADD FILES FILE = * /KEEP id v1 v2 v3 v4.

save outfile = 'c:\spss-test1.sav'.


--jim

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Sanchez, Edgar
Sent: Tuesday, May 27, 2008 5:40 PM
To: [hidden email]
Subject: Save outfile command after Reordering variables

Greetings:



            In a previous post to the group I asked about reordering
variables in a dataset (among other things which I have since worked
out, many thanks to the group). I am still stuck on the reordering of
variables. I had initially had a save command after my access import
(*save outputfile='R:\EDUCATE\PIIE\_Current or Completed Projects\9323
D3M Data Driven Decision Making\Surveys\Analysis\D3M Q1 to Q19.sav'.)
and another after all my manipulations (see below). I have a lot of
variables that get out of order due to many computes etc. Now when I
have both save statements the open file is saved with the correct name
but the reordering accomplished through the keep in the second is not
performed. Now if I comment out the first one the open file is not saved
with proper filename but if I open that created file it has the proper
variable order. How can I get it to save the open file with the proper
name AND actually reorder my variables? Many Thanks!



SAVE OUTFILE='R:\EDUCATE\PIIE\_Current or Completed Projects\9323 D3M
Data Driven Decision Making\Surveys\Analysis\D3M Q1 to Q19.sav'

            /KEEP=District Q_1_1_0_0        Q_1_2_0_0        Q_2_0_0_0
Q_3_0_0_0        Q_4_1_1_0        Q_4_1_2_0             Q_4_1_3_0
Q_4_1_4_0        Q_4_2_1_0

                        Q_4_2_2_0        Q_4_2_3_0        Q_4_2_4_0
Q_4_3_1_0        Q_4_3_2_0        Q_4_3_3_0        Q_4_3_4_0
Q_4_4_1_0        Q_4_4_2_0

                        Q_4_4_3_0        Q_4_4_4_0        Q_4_5_1_0
Q_4_5_2_0        Q_4_5_3_0        Q_4_5_4_0        Q_5_1_1_0
Q_5_1_2_0        Q_5_1_3_0

                        Q_5_2_1_0        Q_5_2_2_0        Q_5_2_3_0
Q_5_3_1_0        Q_5_3_2_0        Q_5_3_3_0        Q_5_4_1_0
Q_5_4_2_0        Q_5_4_3_0

                        Q_5_5_1_0        Q_5_5_2_0        Q_5_5_3_0
Q_6_1   Q_6_1_6_0        Q_6_2   Q_6_2_6_0        Q_6_3
Q_6_3_6_0

                        Q_6_4_1_0        Q_6_4_2_0        Q_6_4_3_0
Q_6_4_4_0        Q_6_4_5_0        Q_7_1   Q_7_1_6_0             Q_7_2
Q_7_2_6_0

                        Q_7_3   Q_7_3_6_0        Q_7_4_1_0
Q_7_4_2_0        Q_7_4_3_0        Q_7_4_4_0        Q_7_4_5_0
Q_8_1_0_0        Q_8_10_0_0

                        Q_8_11_0_0      Q_8_12_0_0      Q_8_13_0_0
Q_8_2_0_0        Q_8_3_0_0        Q_8_4_0_0        Q_8_5_0_0
Q_8_6_0_0        Q_8_7_0_0

                        Q_8_8_0_0        Q_8_9_0_0        Q_9_1_0_0
Q_9_2_0_0        Q_9_3_0_0        Q_9_4_0_0        Q_9_5_0_0
Q_9_6_0_0        Q_9_7_0_0

                        Q_9_8_0_0        Q_9_9_0_0        Q_9_10_0_0
Q_9_11_0_0      Q_9_12_0_0      Q_9_13_0_0      Q_10_1_1_0
Q_10_1_2_0      Q_10_1_3_0

                        Q_10_1_4_0      Q_10_1_5_0      Q_10_1_6_0
Q_10_2_1_0      Q_10_2_2_0      Q_10_2_3_0      Q_10_2_4_0
Q_10_2_5_0      Q_10_2_6_0

                        Q_10_3_1_0      Q_10_3_2_0      Q_10_3_3_0
Q_10_3_4_0      Q_10_3_5_0      Q_10_3_6_0      Q_10_4_1_0
Q_10_4_2_0      Q_10_4_3_0

                        Q_10_4_4_0      Q_10_4_5_0      Q_10_4_6_0
Q_10_5_0_0      Q_10_5_1_0      Q_10_5_2_0      Q_10_5_3_0
Q_10_5_4_0      Q_10_5_5_0

                        Q_10_5_6_0      Q_11    Q_12_1_0_0
Q_12_2_0_0      Q_12_3             Q_12_3_5_0      Q_12_4_1_0
Q_12_4_2_0      Q_12_4_3_0

                        Q_12_4_4_0      Q_12_4_5_0      Q_13_1
Q_13_1_3_0      Q_13_2_0_0      Q_13_3_1_0      Q_13_3_2_0
Q_13_3_3_0      Q_13_3_4_0

                        Q_13_3_5_1      Q_13_3_5_2      Q_13_4_1_0
Q_13_4_2_0      Q_14_1_1_0      Q_14_1_2_0      Q_14_1_3_0
Q_14_2_1_0      Q_14_2_2_0

                        Q_14_2_3_0      Q_14_3_1_0      Q_14_3_2_0
Q_15_1             Q_15_2             Q_15_3             Q_15_4_0_0
Q_15_4             Q_16_0_0_0

                        Q_17_0_0_0      Q_18_1_0_0      Q_18_2_0_0
Q_18_3_0_0      Q_19_1_0_0      Q_19_2_0_0             Q_19_3_0_0.





Edgar I Sanchez, Ph.D.



[hidden email] <mailto:[hidden email]>

http://www.apqceducation.org/ <http://www.apqceducation.org/>



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