Saving numeric data with value labels as strings.

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

Saving numeric data with value labels as strings.

Mark Webb-5
Hi all
I have numeric data with value labels [e.g. 1=Male 2=Female]
It's possible to save this to Excel and request that the value label is
saved rather than the numeric value.
If one wants the string value label in the SPSS file it can read in from
Excel once the variable names have been changed.
Is there a way of saving the value label string of numeric variables
directly into new variables with SPSS?  i.e. skip Excel

Regards

--
Mark Webb

Line +27 (21) 786 4379
Cell +27 (72) 199 1000
Fax to email +27 (86) 5513075
Skype  webbmark
Email  [hidden email]

=====================
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 numeric data with value labels as strings.

Albert-Jan Roskam
Yes, you can do that by adding VALUES=LABELS to the SAVE TRANSLATE command. Check out the syntax reference manual for details.
 
Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: Mark Webb <[hidden email]>
To: [hidden email]
Sent: Sat, April 9, 2011 11:13:25 AM
Subject: [SPSSX-L] Saving numeric data with value labels as strings.

Hi all
I have numeric data with value labels [e.g. 1=Male 2=Female]
It's possible to save this to Excel and request that the value label is
saved rather than the numeric value.
If one wants the string value label in the SPSS file it can read in from
Excel once the variable names have been changed.
Is there a way of saving the value label string of numeric variables
directly into new variables with SPSS?  i.e. skip Excel

Regards

--
Mark Webb

Line +27 (21) 786 4379
Cell +27 (72) 199 1000
Fax to email +27 (86) 5513075
Skype  webbmark
Email  [hidden email]

=====================
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 numeric data with value labels as strings.

Mark Webb-5
Hi Albert-Jan
Just looked at your suggestion and it's not exactly what I'm looking for.
The problem is that Save Translate wants to translate from the normal .sav to some other format.
I want to remain in .sav format.

Basically what I'm trying to do is to make numeric variables into strings so that I can concat them and was thinking that the strings are basically the value labels.

So I will have a variable like sex which is numeric with value labels and I want to make a variable in the same SPSS file called say sexstring which will be a string representing the value label - Male or Female.

Is this clearer?

[BTW - Save Translate has a /cell = labels options according to my syntax reference.]
Mark Webb

Line +27 (21) 786 4379
Cell +27 (72) 199 1000
Fax to email +27 (86) 5513075
Skype  webbmark
Email  [hidden email]

On 2011/04/09 11:47 AM, Albert-Jan Roskam wrote:
Yes, you can do that by adding VALUES=LABELS to the SAVE TRANSLATE command. Check out the syntax reference manual for details.
 
Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: Mark Webb [hidden email]
To: [hidden email]
Sent: Sat, April 9, 2011 11:13:25 AM
Subject: [SPSSX-L] Saving numeric data with value labels as strings.

Hi all
I have numeric data with value labels [e.g. 1=Male 2=Female]
It's possible to save this to Excel and request that the value label is
saved rather than the numeric value.
If one wants the string value label in the SPSS file it can read in from
Excel once the variable names have been changed.
Is there a way of saving the value label string of numeric variables
directly into new variables with SPSS?  i.e. skip Excel

Regards

--
Mark Webb

Line +27 (21) 786 4379
Cell +27 (72) 199 1000
Fax to email +27 (86) 5513075
Skype  webbmark
Email  [hidden email]

=====================
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 numeric data with value labels as strings.

wsu_wright
In reply to this post by Mark Webb-5
Mark,

It sounds like you want to replace within the sav data file the numeric
with string values based on your value labels.  We often have to do a
similar process when we upload data tables to our oracle producttion
systems, the sql folks need the descriptor and not the value.  Try the
following which I learned from this listserv:

string varx (a1).
compute varx =valuelabel(vary).


So if you have a column of 1=male and 2=female called sex then it would
be (the column must have value labels assigned):

string sex_desc(a6).
compute sex_desc=valuelabel(sex).

This will leave leave both your numeric and your string form in the data
file.  If you wish to remove the numeric then you can use DELETE
VARIABLE or MATCH FILES file=* /drop=sex.

David,





On Sat, Apr 9, 2011 at 6:43 AM, Mark Webb wrote:

Hi Albert-Jan

      Just looked at your suggestion and it's not exactly what I'm
looking     for.

      The problem is that Save Translate wants to translate from the
normal .sav to some other format.

      I want to remain in .sav format.



      Basically what I'm trying to do is to make numeric variables into
strings so that I can concat them and was thinking that the strings
are basically the value labels.



      So I will have a variable like sex which is numeric with value
labels and I want to make a variable in the same SPSS file called
say sexstring which will be a string representing the value label -
Male or Female.



      Is this clearer?



      [BTW - Save Translate has a /cell = labels options according to my
syntax reference.]

      Mark Webb

Line +27 (21) 786 4379
Cell +27 (72) 199 1000
Fax to email +27 (86) 5513075
Skype  webbmark
Email  [hidden email] <mailto:[hidden email]>


      On 2011/04/09 11:47 AM, Albert-Jan Roskam wrote:


Yes, you can do that by adding VALUES=LABELS         to the SAVE
TRANSLATE command. Check out the syntax reference         manual for
details.




          Cheers!!

          Albert-Jan




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            All right, but apart from the sanitation, the medicine,
education, wine, public order, irrigation, roads, a fresh
water system, and public health, what have the Romans ever
done for us?

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~









                  From:
                  Mark Webb <[hidden email]>
<mailto:[hidden email]>

                  To:
                  [hidden email]
<mailto:[hidden email]>

                  Sent:
                  Sat, April 9, 2011 11:13:25 AM

                  Subject:
                  [SPSSX-L] Saving numeric data with value labels as
strings.



                Hi all

                I have numeric data with value labels [e.g. 1=Male
2=Female]

                It's possible to save this to Excel and request that the
value label is

                saved rather than the numeric value.

                If one wants the string value label in the SPSS file it
can read in from

                Excel once the variable names have been changed.

                Is there a way of saving the value label string of
numeric               variables

                directly into new variables with SPSS?  i.e. skip Excel



                Regards



                --

                Mark Webb



                Line +27 (21) 786 4379

                Cell +27 (72) 199 1000

                Fax to email +27 (86) 5513075

                Skype  webbmark

                Email  [hidden email]
<mailto:[hidden email]>



                =====================

                To manage your subscription to SPSSX-L, send a message
to

                [hidden email]
<mailto:[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

=====================
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 numeric data with value labels as strings.

Jon K Peck
In reply to this post by Mark Webb-5
You can use the VALUELABEL transformation function to compute a string variable whose value is the value label of a variable.

Jon Peck
Senior Software Engineer, IBM
[hidden email]
312-651-3435




From:        Mark Webb <[hidden email]>
To:        [hidden email]
Date:        04/09/2011 03:16 AM
Subject:        [SPSSX-L] Saving numeric data with value labels as strings.
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi all
I have numeric data with value labels [e.g. 1=Male 2=Female]
It's possible to save this to Excel and request that the value label is
saved rather than the numeric value.
If one wants the string value label in the SPSS file it can read in from
Excel once the variable names have been changed.
Is there a way of saving the value label string of numeric variables
directly into new variables with SPSS?  i.e. skip Excel

Regards

--
Mark Webb

Line +27 (21) 786 4379
Cell +27 (72) 199 1000
Fax to email +27 (86) 5513075
Skype  webbmark
Email  [hidden email]

=====================
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 numeric data with value labels as strings.

Mark Webb-5
In reply to this post by wsu_wright
Thank you David - this is exactly what I need.
This will save me switching between Excel and SPSS which I'm always a
bit nervous about.
A great solution - thanks.

On 2011/04/09 02:10 PM, [hidden email] wrote:

> Mark,
>
> It sounds like you want to replace within the sav data file the
> numeric with string values based on your value labels.  We often have
> to do a similar process when we upload data tables to our oracle
> producttion systems, the sql folks need the descriptor and not the
> value.  Try the following which I learned from this listserv:
>
> string varx (a1).
> compute varx =valuelabel(vary).
>
>
> So if you have a column of 1=male and 2=female called sex then it
> would be (the column must have value labels assigned):
>
> string sex_desc(a6).
> compute sex_desc=valuelabel(sex).
>
> This will leave leave both your numeric and your string form in the
> data file.  If you wish to remove the numeric then you can use DELETE
> VARIABLE or MATCH FILES file=* /drop=sex.
>
> David,
>
>
>
>
>
> On Sat, Apr 9, 2011 at 6:43 AM, Mark Webb wrote:
>
> Hi Albert-Jan
>
>      Just looked at your suggestion and it's not exactly what I'm
> looking     for.
>
>      The problem is that Save Translate wants to translate from the
> normal .sav to some other format.
>
>      I want to remain in .sav format.
>
>
>
>      Basically what I'm trying to do is to make numeric variables into
> strings so that I can concat them and was thinking that the strings
> are basically the value labels.
>
>
>
>      So I will have a variable like sex which is numeric with value
> labels and I want to make a variable in the same SPSS file called say
> sexstring which will be a string representing the value label - Male
> or Female.
>
>
>
>      Is this clearer?
>
>
>
>      [BTW - Save Translate has a /cell = labels options according to
> my syntax reference.]
>
>      Mark Webb
>
> Line +27 (21) 786 4379
> Cell +27 (72) 199 1000
> Fax to email +27 (86) 5513075
> Skype  webbmark
> Email  [hidden email] <mailto:[hidden email]>
>
>
>      On 2011/04/09 11:47 AM, Albert-Jan Roskam wrote:
>
>
> Yes, you can do that by adding VALUES=LABELS         to the SAVE
> TRANSLATE command. Check out the syntax reference         manual for
> details.
>
>
>
>
>          Cheers!!
>
>          Albert-Jan
>
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>            All right, but apart from the sanitation, the medicine,
> education, wine, public order, irrigation, roads, a fresh water
> system, and public health, what have the Romans ever done for us?
>
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
>
>
>
>
>                  From:
>                  Mark Webb <[hidden email]>
> <mailto:[hidden email]>
>
>                  To:
>                  [hidden email]
> <mailto:[hidden email]>
>
>                  Sent:
>                  Sat, April 9, 2011 11:13:25 AM
>
>                  Subject:
>                  [SPSSX-L] Saving numeric data with value labels as
> strings.
>
>
>
>                Hi all
>
>                I have numeric data with value labels [e.g. 1=Male
> 2=Female]
>
>                It's possible to save this to Excel and request that
> the value label is
>
>                saved rather than the numeric value.
>
>                If one wants the string value label in the SPSS file it
> can read in from
>
>                Excel once the variable names have been changed.
>
>                Is there a way of saving the value label string of
> numeric               variables
>
>                directly into new variables with SPSS?  i.e. skip Excel
>
>
>
>                Regards
>
>
>
>                --
>
>                Mark Webb
>
>
>
>                Line +27 (21) 786 4379
>
>                Cell +27 (72) 199 1000
>
>                Fax to email +27 (86) 5513075
>
>                Skype  webbmark
>
>                Email  [hidden email]
> <mailto:[hidden email]>
>
>
>
>                =====================
>
>                To manage your subscription to SPSSX-L, send a message to
>
>                [hidden email]
> <mailto:[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
>

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