save list of variable formats

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

save list of variable formats

Karen Segar
I would like to create a data file that has two variables that contain the
variable names and write formats of all the variables from an existing data
set.  I know I can use DISPLAY VARIABLES to list these things in the
output, copy and paste it to a file, and with some further manipulation
wind up with what I want, but this seems like a rather roundabout way of
doing things.  Is there a better way?

Karen Segar
Data Manager
Social Development Research Group
University of Washington
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: save list of variable formats

Peck, Jon
The easiest way is via OMS.

dataset declare myvariables.
oms
/if subtype='Variable Information'
/destination outfile=myvariables format=sav viewer=no.
display variables.
omsend.

If your version is too old for the dataset command, you can specify outfile as an actual file specification instead.

The oms command captures the table of type 'variable information' that is generated by the display command.  When omsend is executed, it creates a dataset with the contents of that table.

Regards,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Karen Segar
Sent: Friday, December 22, 2006 4:48 PM
To: [hidden email]
Subject: [SPSSX-L] save list of variable formats

I would like to create a data file that has two variables that contain the
variable names and write formats of all the variables from an existing data
set.  I know I can use DISPLAY VARIABLES to list these things in the
output, copy and paste it to a file, and with some further manipulation
wind up with what I want, but this seems like a rather roundabout way of
doing things.  Is there a better way?

Karen Segar
Data Manager
Social Development Research Group
University of Washington
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: save list of variable formats

Karen Segar
In reply to this post by Karen Segar
This isn't working for me.  'Variable Information' isn't listed as a valid
command or subtype for DISPLAY for OMS in the syntax guide for v12, so all
I'm getting are Notes when I eliminate any reference to commands or
subtypes.  We're supposed to upgrade to v14 soon, so I guess maybe I'm
stuck doing things the hard way until then, unless I'm mistaken about the
limitations of OMS in v12 or somebody else has another idea.  But thanks
for pointing me toward OMS.  I haven't had v12 for long and hadn't explored
that yet.

Karen

On Fri, 22 Dec 2006 17:02:31 -0600, Peck, Jon <[hidden email]> wrote:

>The easiest way is via OMS.
>
>dataset declare myvariables.
>oms
>/if subtype='Variable Information'
>/destination outfile=myvariables format=sav viewer=no.
>display variables.
>omsend.
>
>If your version is too old for the dataset command, you can specify
outfile as an actual file specification instead.
>
>The oms command captures the table of type 'variable information' that is
generated by the display command.  When omsend is executed, it creates a
dataset with the contents of that table.
>
>Regards,
>Jon Peck
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Karen Segar

>Sent: Friday, December 22, 2006 4:48 PM
>To: [hidden email]
>Subject: [SPSSX-L] save list of variable formats
>
>I would like to create a data file that has two variables that contain the
>variable names and write formats of all the variables from an existing data
>set.  I know I can use DISPLAY VARIABLES to list these things in the
>output, copy and paste it to a file, and with some further manipulation
>wind up with what I want, but this seems like a rather roundabout way of
>doing things.  Is there a better way?
>
>Karen Segar
>Data Manager
>Social Development Research Group
>University of Washington
>[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: save list of variable formats

Peck, Jon
Ah.  In version 12, the output of the Display commands was not in the form of pivot tables.  It would be type text.  You could still capture this with OMS as a text file and then read that back in as data, perhaps with a little editing.

I don't have 12 around anymore, but you could try something like this.
OMS
 /SELECT TEXTS
/DESTINATION FORMAT = TEXT
  OUTFILE = "c:\temp\fred.txt".
display variables.
omsend.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Karen Segar
Sent: Friday, December 22, 2006 6:46 PM
To: [hidden email]
Subject: Re: [SPSSX-L] save list of variable formats

This isn't working for me.  'Variable Information' isn't listed as a valid
command or subtype for DISPLAY for OMS in the syntax guide for v12, so all
I'm getting are Notes when I eliminate any reference to commands or
subtypes.  We're supposed to upgrade to v14 soon, so I guess maybe I'm
stuck doing things the hard way until then, unless I'm mistaken about the
limitations of OMS in v12 or somebody else has another idea.  But thanks
for pointing me toward OMS.  I haven't had v12 for long and hadn't explored
that yet.

Karen

On Fri, 22 Dec 2006 17:02:31 -0600, Peck, Jon <[hidden email]> wrote:

>The easiest way is via OMS.
>
>dataset declare myvariables.
>oms
>/if subtype='Variable Information'
>/destination outfile=myvariables format=sav viewer=no.
>display variables.
>omsend.
>
>If your version is too old for the dataset command, you can specify
outfile as an actual file specification instead.
>
>The oms command captures the table of type 'variable information' that is
generated by the display command.  When omsend is executed, it creates a
dataset with the contents of that table.
>
>Regards,
>Jon Peck
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Karen Segar

>Sent: Friday, December 22, 2006 4:48 PM
>To: [hidden email]
>Subject: [SPSSX-L] save list of variable formats
>
>I would like to create a data file that has two variables that contain the
>variable names and write formats of all the variables from an existing data
>set.  I know I can use DISPLAY VARIABLES to list these things in the
>output, copy and paste it to a file, and with some further manipulation
>wind up with what I want, but this seems like a rather roundabout way of
>doing things.  Is there a better way?
>
>Karen Segar
>Data Manager
>Social Development Research Group
>University of Washington
>[hidden email]