Revised question: Syntax for outfile

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

Revised question: Syntax for outfile

J McClure
Hi,
**Additional problem: my new file does not contain the variable N_Break.
(I got the code from
http://www.ats.ucla.edu/stat/spss/faq/nummiss_spss.htm) Thanks.

What I want: a new file with just the variables listed in the code below
that is located where I want it, and opens at the end of the program so
that I can see the results.
What I tried: I used this syntax but the outfile was saved in a location
I don't want.
AGGREGATE
   /OUTFILE='AGGRTest.SAV'
   /BREAK= EmpStat1    MaritStat1   HousStat1   RaceEth11  RaceEth21
EdLevel1  Rx_source1  Trans_yn1
   /N_BREAK=N.
I tried changing the default location using edit->options->specified
folder->  and change the location for both data files and other files but
that didn't work so I added the following line
Save OUTFILE="C:\Jan\PhD\PhD_analysis\VStudy1DT/AGGRTest.SAV".
Now it saves AGGRTest.SAV over my original datafile (with all of my 150
original variables) and adds the variables listed above to the end of
the file. It does open automatically when I run the program.
Thanks,
Jan

=====================
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: Revised question: Syntax for outfile

Ruben Geert van den Berg
Dear Jan,

My advice is this: look up in the command syntax reference:

-dataset name
-dataset close
-dataset activate
-dataset copy
-dataset declare

(you can abbreviate it to 'datas nam'/'datas dec' if you like, you can't abbreviate 'dataset' any further than 'datas')

Working with datasets takes a couple of days to get used to but you'll soon wish you'd discovered this before!!

I know many listers prefer file handles but I like to put a CD command in my syntax like

cd 'c:/temp'.

Now I don't need any paths anymore and if my project moves to another folder, I modify it to

*cd 'c:/temp'.
cd 'd:/temp'.

As soon as you open any .sav file, give the dataset a name like d1. Like

get fil'blah.sav'.
dataset name d1.

If you want to create new data with aggregate (assuming you've only d1 open), use something like

dataset declare d2.
aggregate
/outfile d2
/blah blah....

Now you can inspect your new data before you save it. If you don't like it, run

dataset close d2.
dataset activate d1.

And try the aggregate again.

HTH,

Ruben van den Berg
Consultant Models & Methods
TNS NIPO
Email: [hidden email]
Mobiel: +31 6 24641435
Telefoon: +31 20 522 5738
Internet: www.tns-nipo.com




> Date: Sun, 22 Aug 2010 10:31:40 -0700
> From: [hidden email]
> Subject: Revised question: Syntax for outfile
> To: [hidden email]
>
> Hi,
> **Additional problem: my new file does not contain the variable N_Break.
> (I got the code from
> http://www.ats.ucla.edu/stat/spss/faq/nummiss_spss.htm) Thanks.
>
> What I want: a new file with just the variables listed in the code below
> that is located where I want it, and opens at the end of the program so
> that I can see the results.
> What I tried: I used this syntax but the outfile was saved in a location
> I don't want.
> AGGREGATE
> /OUTFILE='AGGRTest.SAV'
> /BREAK= EmpStat1 MaritStat1 HousStat1 RaceEth11 RaceEth21
> EdLevel1 Rx_source1 Trans_yn1
> /N_BREAK=N.
> I tried changing the default location using edit->options->specified
> folder-> and change the location for both data files and other files but
> that didn't work so I added the following line
> Save OUTFILE="C:\Jan\PhD\PhD_analysis\VStudy1DT/AGGRTest.SAV".
> Now it saves AGGRTest.SAV over my original datafile (with all of my 150
> original variables) and adds the variables listed above to the end of
> the file. It does open automatically when I run the program.
> Thanks,
> Jan
>
> =====================
> 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: Revised question: Syntax for outfile

Antoon Smulders

Sorry for my previous reply to Jan, I didn’t see the answers in the revised topic name until now.

Antoon

 

Van: SPSSX(r) Discussion [mailto:[hidden email]] Namens Ruben van den Berg
Verzonden: maandag 23 augustus 2010 7:19
Aan: [hidden email]
Onderwerp: Re: Revised question: Syntax for outfile

 

Dear Jan,

 

My advice is this: look up in the command syntax reference:

 

-dataset name

-dataset close

-dataset activate

-dataset copy

-dataset declare

 

(you can abbreviate it to 'datas nam'/'datas dec' if you like, you can't abbreviate 'dataset' any further than 'datas')

 

Working with datasets takes a couple of days to get used to but you'll soon wish you'd discovered this before!!

 

I know many listers prefer file handles but I like to put a CD command in my syntax like

 

cd 'c:/temp'.

 

Now I don't need any paths anymore and if my project moves to another folder, I modify it to

 

*cd 'c:/temp'.

cd 'd:/temp'.

 

As soon as you open any .sav file, give the dataset a name like d1. Like

 

get fil'blah.sav'.

dataset name d1.

 

If you want to create new data with aggregate (assuming you've only d1 open), use something like

 

dataset declare d2.

aggregate

/outfile d2

/blah blah....

 

Now you can inspect your new data before you save it. If you don't like it, run

 

dataset close d2.

dataset activate d1.

 

And try the aggregate again.

 

HTH,

Ruben van den Berg
Consultant Models & Methods
TNS NIPO
Email: [hidden email]
Mobiel: +31 6 24641435
Telefoon: +31 20 522 5738
Internet: www.tns-nipo.com




> Date: Sun, 22 Aug 2010 10:31:40 -0700
> From: [hidden email]
> Subject: Revised question: Syntax for outfile
> To: [hidden email]
>
> Hi,
> **Additional problem: my new file does not contain the variable N_Break.
> (I got the code from
> http://www.ats.ucla.edu/stat/spss/faq/nummiss_spss.htm) Thanks.
>
> What I want: a new file with just the variables listed in the code below
> that is located where I want it, and opens at the end of the program so
> that I can see the results.
> What I tried: I used this syntax but the outfile was saved in a location
> I don't want.
> AGGREGATE
> /OUTFILE='AGGRTest.SAV'
> /BREAK= EmpStat1 MaritStat1 HousStat1 RaceEth11 RaceEth21
> EdLevel1 Rx_source1 Trans_yn1
> /N_BREAK=N.
> I tried changing the default location using edit->options->specified
> folder-> and change the location for both data files and other files but
> that didn't work so I added the following line
> Save OUTFILE="C:\Jan\PhD\PhD_analysis\VStudy1DT/AGGRTest.SAV".
> Now it saves AGGRTest.SAV over my original datafile (with all of my 150
> original variables) and adds the variables listed above to the end of
> the file. It does open automatically when I run the program.
> Thanks,
> Jan
>
> =====================
> 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