Fw: Restructure datafile

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

Fw: Restructure datafile

Juris Breidaks
Dear list members,

I have data and i need only save variable view table from SPSS , as
example down,

       Name         Type        Width   Decimals
1 VAR00001   Numeric      8       2
2 VAR00002   String       2       0
3 VAR00003    Numeric     3       2
4 VAR00004    Numeric     4       2

I need transform data variables in text file need look like this

VAR00001   N 8 2
VAR00002   A2
VAR00003   N 3 2
VAR00004   N 4 2

What do you think is the best way to approach this? I can see three ways
to restructure
A) some macro
B) some script
C) python

I am sure that there is a simple and elegant solution, that I am
missing.

Sincerely,

Juris

=====================
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: Restructure datafile

Maguin, Eugene
Juris,

How did you get the variable view table to export to a file? I'd like to
learn how to do that as I've assumed that you couldn't do that.

As to your specific question, I'd just write some syntax. Basically, the
only difference is that you extracted the first character from the Type
variable. That's easily done using the substr function. Look at the string
functions subsection of the universals section in the syntax reference or
search for 'function' in help.

Gene Maguin


>>I have data and i need only save variable view table from SPSS , as
example down,

       Name         Type        Width   Decimals
1 VAR00001   Numeric      8       2
2 VAR00002   String       2       0
3 VAR00003    Numeric     3       2
4 VAR00004    Numeric     4       2

I need transform data variables in text file need look like this

VAR00001   N 8 2
VAR00002   A2
VAR00003   N 3 2
VAR00004   N 4 2

What do you think is the best way to approach this? I can see three ways
to restructure
A) some macro
B) some script
C) python

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