Re: saving data and labels

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

Re: saving data and labels

Albert-Jan Roskam
Hi!

You could use the VALUELABEL option:
STRING labelvar (a80).
COMPUTE labelvar = VALUELABEL(original_var).

You could use DO REPEAT, or Python, or a macro to quickly do this for all vars.

Cheers!!
Albert-Jan

--- On Sun, 4/19/09, David Wright <[hidden email]> wrote:

> From: David Wright <[hidden email]>
> Subject: saving data and labels
> To: [hidden email]
> Date: Sunday, April 19, 2009, 4:52 PM
> I have a client who wants a pasw
> syntax file to export sav files as tab delimited in which
> factors that have value labels will export BOTH the data
> value and label value (in separate columns of course but
> adjacent columns).
>
> For example:
>
> id  female
> 123   0
> 124   1
>
> id   female   female_desc
> 123    0    male
> 124    1    female
>
> The SAVE TRANSLATE command provides the option to save
> values or labels but doesn't appear to provide both and even
> if it did I don't see how it would get around the different
> variable names (orig & orig_desc, although the client
> would be ok with orig & orig.1, a naming convention pasw
> uses when restructuring data).
>
> My current method seems long handed & was wondering
> about alternatives:
>
> >open the original sav file.
> >rename those variables which have value labels with the
> %_desc & save out the data file with labels
> >close original sav file & reopen to reinstate
> variable labels
> >import the saved tab delimited file.
> >then match files to bring both together  on a
> common id
> > then save out as tab delimited with a /keep subcomand
> to make columns adjacent when needed.
>
> Client does not have python so I'd be restricted to
> standard pasw syntax.
>
> Thanks for any assistance.
>
> David
>
> =====================
> 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
>

=====================
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: saving data and labels

wsu_wright
Elegantly simple!  Thank you very much.

David


---- Albert-jan Roskam <[hidden email]> wrote:
>
> Hi!

You could use the VALUELABEL option:
STRING labelvar (a80).
COMPUTE labelvar = VALUELABEL(original_var).

You could use DO REPEAT, or Python, or a macro to quickly do this for all vars.

Cheers!!
Albert-Jan

--- On Sun, 4/19/09, David Wright <[hidden email]> wrote:

> From: David Wright <[hidden email]>
> Subject: saving data and labels
> To: [hidden email]
> Date: Sunday, April 19, 2009, 4:52 PM
> I have a client who wants a pasw
> syntax file to export sav files as tab delimited in which
> factors that have value labels will export BOTH the data
> value and label value (in separate columns of course but
> adjacent columns).
>
> For example:
>
> id�  female
> 123� � � 0
> 124� � � 1
>
> id� � � female� � � female_desc
> 123�  �  0�  �  male
> 124�  �  1�  �  female
>
> The SAVE TRANSLATE command provides the option to save
> values or labels but doesn't appear to provide both and even
> if it did I don't see how it would get around the different
> variable names (orig & orig_desc, although the client
> would be ok with orig & orig.1, a naming convention pasw
> uses when restructuring data).
>
> My current method seems long handed & was wondering
> about alternatives:
>
> >open the original sav file.
> >rename those variables which have value labels with the
> %_desc & save out the data file with labels
> >close original sav file & reopen to reinstate
> variable labels
> >import the saved tab delimited file.
> >then match files to bring both together�  on a
> common id
> > then save out as tab delimited with a /keep subcomand
> to make columns adjacent when needed.
>
> Client does not have python so I'd be restricted to
> standard pasw syntax.
>
> Thanks for any assistance.
>
> David
>
> =====================
> 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
>

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