Data Syntax Editor

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

Data Syntax Editor

hope1958
How do I convert data syntax files to regular SPSS files?  I have these SPSS
files but cannot make them work.



 For example, my editor file says:



THE SPSS CODE SHOWN BELOW WILL LOAD THE ASCII

*      INPATIENT STAY CORE FILE INTO SPSS

*******************************************************************/





*******************************.

*  Define the data file       *.

*******************************.



DATA LIST FILE = 'SC_SID_2005_CORE.ASC' FIXED /

 KEY                        1-  14

 AMONTH                    15-  16

 ASOURCE                   17-  18

 ASOURCE_                  19     (A)



***  Assign labels to the variables ***.

VARIABLE LABELS

 KEY       "HCUP record identifier"

 AMONTH    "Admission month"





SAVE OUTFILE = 'SC_SID_2005_CORE.SAV' /COMPRESSED.



Kevin







A. Kevin Hunter, II

To be, or what?- Sylvester Stallone
Reply | Threaded
Open this post in threaded view
|

Re: Data Syntax Editor

Richard Ristow
At 10:05 PM 8/29/2007, hope1958 wrote:

>How do I convert data syntax files to regular SPSS files?  I have
>these SPSS files but cannot make them work.

By "regular SPSS files", I assume you mean SPSS .SAV files.

>  For example, my editor file says:
>
>*      THE SPSS CODE SHOWN BELOW WILL LOAD THE ASCII
>*      INPATIENT STAY CORE FILE INTO SPSS
>*******************************************************************/
>
>
>*******************************.
>*  Define the data file       *.
>*******************************.
>
>DATA LIST FILE = 'SC_SID_2005_CORE.ASC' FIXED /
>  KEY                        1-  14
>  AMONTH                    15-  16
>  ASOURCE                   17-  18
>  ASOURCE_                  19     (A)
>
>***  Assign labels to the variables ***.
>VARIABLE LABELS
>  KEY       "HCUP record identifier"
>  AMONTH    "Admission month"
>
>SAVE OUTFILE = 'SC_SID_2005_CORE.SAV' /COMPRESSED.


That is the code (the syntax) to load an external data file and save it
as a .SAV file. You should also have the external data file, probably
named SC_SID_2005_CORE.ASC. (Many data sets are shipped like that: a
data file, and SPSS syntax to read the data and save it as a .SAV
file.)

A. Make a backup copy of the syntax file (the file you listed above)!

B. Start SPSS, and load the syntax file into a syntax window.

C. In the statement

DATA LIST FILE = 'SC_SID_2005_CORE.ASC' FIXED /

add the path to where the data file is:

DATA LIST FILE = 'c:\Documents and Settings\Kevin' +
                  '\SC_Project\SC_SID_2005_CORE.ASC'
                   FIXED /
(etc.)
Of course, fill in your path, not the one I made up, there.

D. In the statement

SAVE OUTFILE = 'SC_SID_2005_CORE.SAV' /COMPRESSED.

add the path, probably to the same directory as the data:

SAVE OUTFILE = 'c:\Documents and Settings\Kevin' +
                '\SC_Project\SC_SID_2005_CORE.SAV'
                /COMPRESSED.

E. Save the file with these changes, so you won't have to make them
again if something goes wrong.

F. In the menus at the top of the syntax window, select Run>All.