Time SEries out of Separate Data Files

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

Time SEries out of Separate Data Files

Simon Kiss-2
Dear colleagues,
One problem that I continually face as a political scientist is that I
like to use things like public opinion data over time.  However, this
data is almost invariably contained as frequencies (vote intention) in
separate data files.  I could open each separate data file, select the
relevant data and then save it in a separate excel files. But there
must be a script or a way to automate this.
Can anyone suggest where I could look to find some help with this?
Yours,
Simon Kiss
*********************************
Simon J. Kiss, PhD
SSHRC and DAAD Post-Doctoral Fellow
John F. Kennedy Institute of North America Studies
Free University of Berlin
Lansstraße 7-9
14195 Berlin, Germany
Cell: +49 (0)1525-300-2812,
Web: http://www.jfki.fu-berlin.de/index.html

=====================
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: Time SEries out of Separate Data Files

Richard Ristow
At 11:31 AM 2/24/2009, Simon Kiss wrote:

>I like to use things like public opinion data over time.  This data
>is almost invariably contained as frequencies (vote intention) in
>separate data files.

I suppose, one for each year, or whatever the interval is between
surveys, with pretty much the same set of variables in each? That's a
common way of sending repeating sets, like surveys and censuses.

>I could open each separate data file, select the relevant data and
>then save it in a separate excel files. But there must be a script
>or a way to automate this.

Usually, you want to catenate the files from the times you're
interested in, making sure the source of every record in the new file
is identified. If your separate files are already SPSS data files,
you do this with ADD FILES with /IN variables, like this (not tested):

ADD FILES
   /FILE=SURVEY01 /IN=YEAR2001
   /FILE=SURVEY02 /IN=YEAR2002
...

Then, you can usually do what you want by sorting, selecting,
sometimes aggregating, sometimes restructuring.

But, you probably don't get the data as SPSS files. Often, you'll
convert the files you receive (text, Excel, or whatever) to SPSS data
files, and then use ADD FILES.

If you have a lot of files, you'd probably like to automate the
conversion. Basically, that can be done with macros or Python. See
the thread "Loop for different file names", begun Wed, 14 Jan 2009
14:52:42 +0000. In that thread, at 12:46 PM 1/14/2009, Peck, Jon wrote:

>[For Python], the spssaux3.py module on Developer Central has a
>general function, ApplySyntaxToFiles, that will run through a
>wildcard-specified file list and run syntax against them with
>various options for handling the display output or modified sav
>files and logging.

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