Recode and lose values - ADDENDUM

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

Recode and lose values - ADDENDUM

Leslie-26
I am recoding three environment variables (civilian, military, blend
military/civilian) into two age groups (1-young, 2-old) and find that on the
recode the total number between the groups is not equal to the original
number, in addition, one environment appears to have no value. Below, I
include the descriptives before the recode and then after the recode, and
below that I've embedded the syntax.

If you can help me understand where I've gone wrong I greatly appreciate
your insight and help.

Leslie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DESCRIPTIVES BEFORE RECODE
AGE BEFORE
AgeG2r
Frequency Percent Valid Percent Cumulative Percent
Valid 1.00 440 44.5  44.6 44.6
      2.00 546 55.2  55.4 100.0
Total 986      99.7 100.0
Missing System 3 .3
Total 989 100.0

CIVILIAN BEFORE RECODE
ETHN3_1c
Frequency Percent Valid Percent Cumulative Percent
Valid 1.00 28  2.8  71.8 71.8
      2.00  8   .8  20.5 92.3
      3.00  3   .3   7.7 100.0
Total      39  3.9 100.0
Missing System 950 96.1
Total 989 100.0

CROSSTAB BEFORE RECODE
ETHN3_1c * AgeG2r Crosstabulation
Count
    AgeG2r  Total
  1.00 2.00
ETHN3_1c  1.00 13 15 28
   2.00 3 4 7
   3.00 2 1 3
Total  18 20 38


DESCRIPTIVES AFTER RECODE
Young CIVILIAN AFTER
ETHN3_1c1
Frequency Percent Valid Percent Cumulative Percent
Valid 2.00 3 .3  60.0   60.0
      3.00 2 .2  40.0   100.0
Total      5 .5 100.0
Missing System 984 99.5
Total 989 100.0

Old CIVILIAN AFTER
ETHN3_1c2
    Frequency Percent Valid Percent Cumulative Percent
Valid 2.00 4 .4 80.0 80.0
 3.00 1 .1 20.0 100.0
 Total 5 .5 100.0
Missing System 984 99.5
Total  989 100.0




SYNTAX
COMMENT break each ethnicity/environment into two age groups.

COMMENT civilian young
IF (AgeG2r = 1 & ETHN3_1c = 1) ETHN3_1c1 = 1 .
EXECUTE .
IF (AgeG2r = 1 & ETHN3_1c = 2) ETHN3_1c1 = 2 .
EXECUTE .
IF (AgeG2r = 1 & ETHN3_1c = 3) ETHN3_1c1 = 3 .
EXECUTE .
VALUE LABEL ENV 1 'young white Citizen Only'
2 'young afam citizen only'
3 'young other citizen only'
EXECUTE.
FREQUENCIES
VARIABLES= AgeG2r ETHN3_1c ETHN3_1c1
/BARCHART FREQ
/ORDER= ANALYSIS .

COMMENT civilian old
IF (AgeG2r = 2 & ETHN3_1c = 1) ETHN3_1c2 = 1 .
EXECUTE .
IF (AgeG2r = 2 & ETHN3_1c = 2) ETHN3_1c2 = 2 .
EXECUTE .
IF (AgeG2r = 2 & ETHN3_1c = 3) ETHN3_1c2 = 3 .
EXECUTE .
VALUE LABEL ENV 1 'old white Citizen Only'
2 'old afam citizen only'
3 'old other citizen only'
EXECUTE.
FREQUENCIES
VARIABLES=ETHN3_1c2
/BARCHART FREQ
/ORDER= ANALYSIS .


COMMENT military young
IF (AgeG2r = 1 & ETHN3_1m = 1) ETHN3_1m1 = 1 .
EXECUTE .
IF (AgeG2r = 1 & ETHN3_1m = 2) ETHN3_1m1 = 2 .
EXECUTE .
IF (AgeG2r = 1 & ETHN3_1m = 3) ETHN3_1m1 = 3 .
EXECUTE .
VALUE LABEL ENV 1 'young white military Only'
2 'young afam military only'
3 'young other military only'
EXECUTE.
FREQUENCIES
VARIABLES=ETHN3_1m1
/BARCHART FREQ
/ORDER= ANALYSIS .

COMMENT military old
IF (AgeG2r = 2 & ETHN3_1m = 1) ETHN3_1m2 = 1 .
EXECUTE .
IF (AgeG2r = 2 & ETHN3_1m = 2) ETHN3_1m2 = 2 .
EXECUTE .
IF (AgeG2r = 2 & ETHN3_1m = 3) ETHN3_1m2 = 3 .
EXECUTE .
VALUE LABEL ENV 1 'old white military Only'
2 'old afam military only'
3 'old other military only'
EXECUTE.
FREQUENCIES
VARIABLES=ETHN3_1m2
/BARCHART FREQ
/ORDER= ANALYSIS .


COMMENT both young
IF (AgeG2r = 1 & ETHN3_1cm = 1) ETHN3_1cm1 = 1 .
EXECUTE .
IF (AgeG2r = 1 & ETHN3_1cm = 2) ETHN3_1cm1 = 2 .
EXECUTE .
IF (AgeG2r = 1 & ETHN3_1cm = 3) ETHN3_1cm1 = 3 .
EXECUTE .
VALUE LABEL ENV 1 'young white both'
2 'young afam both'
3 'young other both'
EXECUTE.
FREQUENCIES
VARIABLES=ETHN3_1cm1
/BARCHART FREQ
/ORDER= ANALYSIS .

COMMENT both old
IF (AgeG2r = 2 & ETHN3_1cm = 1) ETHN3_1cm2 = 1 .
EXECUTE .
IF (AgeG2r = 2 & ETHN3_1cm = 2) ETHN3_1cm2 = 2 .
EXECUTE .
IF (AgeG2r = 2 & ETHN3_1cm = 3) ETHN3_1cm2 = 3 .
EXECUTE .
VALUE LABEL ENV 1 'old white both'
2 'old afam both'
3 'old other both'
EXECUTE.
FREQUENCIES
VARIABLES=ETHN3_1cm2
/BARCHART FREQ
/ORDER= ANALYSIS .
Reply | Threaded
Open this post in threaded view
|

Re: Recode and lose values - ADDENDUM

Albert-Jan Roskam
Hi Leslie,

As a check, why don't you try:
sort cases by AgeG2r.
temporary.
split file layered by AgeG2r.
fre ETHN3_1c.

In your syntax you should:
-recode into a new variable (i.e. not overwrite the
old one).
-get rid of all EXECUTEs (this is more efficient).


Albert-Jan

--- Leslie <[hidden email]> wrote:

> I am recoding three environment variables (civilian,
> military, blend
> military/civilian) into two age groups (1-young,
> 2-old) and find that on the
> recode the total number between the groups is not
> equal to the original
> number, in addition, one environment appears to have
> no value. Below, I
> include the descriptives before the recode and then
> after the recode, and
> below that I've embedded the syntax.
>
> If you can help me understand where I've gone wrong
> I greatly appreciate
> your insight and help.
>
> Leslie
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>
> DESCRIPTIVES BEFORE RECODE
> AGE BEFORE
> AgeG2r
> Frequency Percent Valid Percent Cumulative Percent
> Valid 1.00 440 44.5  44.6 44.6
>       2.00 546 55.2  55.4 100.0
> Total 986      99.7 100.0
> Missing System 3 .3
> Total 989 100.0
>
> CIVILIAN BEFORE RECODE
> ETHN3_1c
> Frequency Percent Valid Percent Cumulative Percent
> Valid 1.00 28  2.8  71.8 71.8
>       2.00  8   .8  20.5 92.3
>       3.00  3   .3   7.7 100.0
> Total      39  3.9 100.0
> Missing System 950 96.1
> Total 989 100.0
>
> CROSSTAB BEFORE RECODE
> ETHN3_1c * AgeG2r Crosstabulation
> Count
>     AgeG2r  Total
>   1.00 2.00
> ETHN3_1c  1.00 13 15 28
>    2.00 3 4 7
>    3.00 2 1 3
> Total  18 20 38
>
>
> DESCRIPTIVES AFTER RECODE
> Young CIVILIAN AFTER
> ETHN3_1c1
> Frequency Percent Valid Percent Cumulative Percent
> Valid 2.00 3 .3  60.0   60.0
>       3.00 2 .2  40.0   100.0
> Total      5 .5 100.0
> Missing System 984 99.5
> Total 989 100.0
>
> Old CIVILIAN AFTER
> ETHN3_1c2
>     Frequency Percent Valid Percent Cumulative
> Percent
> Valid 2.00 4 .4 80.0 80.0
>  3.00 1 .1 20.0 100.0
>  Total 5 .5 100.0
> Missing System 984 99.5
> Total  989 100.0
>
>
>
>
> SYNTAX
> COMMENT break each ethnicity/environment into two
> age groups.
>
> COMMENT civilian young
> IF (AgeG2r = 1 & ETHN3_1c = 1) ETHN3_1c1 = 1 .
> EXECUTE .
> IF (AgeG2r = 1 & ETHN3_1c = 2) ETHN3_1c1 = 2 .
> EXECUTE .
> IF (AgeG2r = 1 & ETHN3_1c = 3) ETHN3_1c1 = 3 .
> EXECUTE .
> VALUE LABEL ENV 1 'young white Citizen Only'
> 2 'young afam citizen only'
> 3 'young other citizen only'
> EXECUTE.
> FREQUENCIES
> VARIABLES= AgeG2r ETHN3_1c ETHN3_1c1
> /BARCHART FREQ
> /ORDER= ANALYSIS .
>
> COMMENT civilian old
> IF (AgeG2r = 2 & ETHN3_1c = 1) ETHN3_1c2 = 1 .
> EXECUTE .
> IF (AgeG2r = 2 & ETHN3_1c = 2) ETHN3_1c2 = 2 .
> EXECUTE .
> IF (AgeG2r = 2 & ETHN3_1c = 3) ETHN3_1c2 = 3 .
> EXECUTE .
> VALUE LABEL ENV 1 'old white Citizen Only'
> 2 'old afam citizen only'
> 3 'old other citizen only'
> EXECUTE.
> FREQUENCIES
> VARIABLES=ETHN3_1c2
> /BARCHART FREQ
> /ORDER= ANALYSIS .
>
>
> COMMENT military young
> IF (AgeG2r = 1 & ETHN3_1m = 1) ETHN3_1m1 = 1 .
> EXECUTE .
> IF (AgeG2r = 1 & ETHN3_1m = 2) ETHN3_1m1 = 2 .
> EXECUTE .
> IF (AgeG2r = 1 & ETHN3_1m = 3) ETHN3_1m1 = 3 .
> EXECUTE .
> VALUE LABEL ENV 1 'young white military Only'
> 2 'young afam military only'
> 3 'young other military only'
> EXECUTE.
> FREQUENCIES
> VARIABLES=ETHN3_1m1
> /BARCHART FREQ
> /ORDER= ANALYSIS .
>
> COMMENT military old
> IF (AgeG2r = 2 & ETHN3_1m = 1) ETHN3_1m2 = 1 .
> EXECUTE .
> IF (AgeG2r = 2 & ETHN3_1m = 2) ETHN3_1m2 = 2 .
> EXECUTE .
> IF (AgeG2r = 2 & ETHN3_1m = 3) ETHN3_1m2 = 3 .
> EXECUTE .
> VALUE LABEL ENV 1 'old white military Only'
> 2 'old afam military only'
> 3 'old other military only'
> EXECUTE.
> FREQUENCIES
> VARIABLES=ETHN3_1m2
> /BARCHART FREQ
> /ORDER= ANALYSIS .
>
>
> COMMENT both young
> IF (AgeG2r = 1 & ETHN3_1cm = 1) ETHN3_1cm1 = 1 .
> EXECUTE .
> IF (AgeG2r = 1 & ETHN3_1cm = 2) ETHN3_1cm1 = 2 .
> EXECUTE .
> IF (AgeG2r = 1 & ETHN3_1cm = 3) ETHN3_1cm1 = 3 .
> EXECUTE .
> VALUE LABEL ENV 1 'young white both'
> 2 'young afam both'
> 3 'young other both'
> EXECUTE.
> FREQUENCIES
> VARIABLES=ETHN3_1cm1
> /BARCHART FREQ
> /ORDER= ANALYSIS .
>
> COMMENT both old
> IF (AgeG2r = 2 & ETHN3_1cm = 1) ETHN3_1cm2 = 1 .
> EXECUTE .
> IF (AgeG2r = 2 & ETHN3_1cm = 2) ETHN3_1cm2 = 2 .
> EXECUTE .
> IF (AgeG2r = 2 & ETHN3_1cm = 3) ETHN3_1cm2 = 3 .
> EXECUTE .
> VALUE LABEL ENV 1 'old white both'
> 2 'old afam both'
> 3 'old other both'
> EXECUTE.
> FREQUENCIES
> VARIABLES=ETHN3_1cm2
> /BARCHART FREQ
> /ORDER= ANALYSIS .
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.
http://searchmarketing.yahoo.com/
Reply | Threaded
Open this post in threaded view
|

Re: Recode and lose values - ADDENDUM

Jerabek Jindrich
Hi Leslie,

There is a comment in your syntax without dot the :
> COMMENT civilian old (change it to COMMENT civilian old.)
This can cause the trouble, because without dot the following line is read as part of the comment and not executed.

Regards
Jindra

> ------------ Původní zpráva ------------
> Od: Albert-jan Roskam <[hidden email]>
> Předmět: Re: Recode and lose values - ADDENDUM
> Datum: 12.9.2007 09:52:12
> ----------------------------------------
> Hi Leslie,
>
> As a check, why don't you try:
> sort cases by AgeG2r.
> temporary.
> split file layered by AgeG2r.
> fre ETHN3_1c.
>
> In your syntax you should:
> -recode into a new variable (i.e. not overwrite the
> old one).
> -get rid of all EXECUTEs (this is more efficient).
>
>
> Albert-Jan
>
> --- Leslie <[hidden email]> wrote:
>
> > I am recoding three environment variables (civilian,
> > military, blend
> > military/civilian) into two age groups (1-young,
> > 2-old) and find that on the
> > recode the total number between the groups is not
> > equal to the original
> > number, in addition, one environment appears to have
> > no value. Below, I
> > include the descriptives before the recode and then
> > after the recode, and
> > below that I've embedded the syntax.
> >
> > If you can help me understand where I've gone wrong
> > I greatly appreciate
> > your insight and help.
> >
> > Leslie
> >
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > DESCRIPTIVES BEFORE RECODE
> > AGE BEFORE
> > AgeG2r
> > Frequency Percent Valid Percent Cumulative Percent
> > Valid 1.00 440 44.5  44.6 44.6
> >       2.00 546 55.2  55.4 100.0
> > Total 986      99.7 100.0
> > Missing System 3 .3
> > Total 989 100.0
> >
> > CIVILIAN BEFORE RECODE
> > ETHN3_1c
> > Frequency Percent Valid Percent Cumulative Percent
> > Valid 1.00 28  2.8  71.8 71.8
> >       2.00  8   .8  20.5 92.3
> >       3.00  3   .3   7.7 100.0
> > Total      39  3.9 100.0
> > Missing System 950 96.1
> > Total 989 100.0
> >
> > CROSSTAB BEFORE RECODE
> > ETHN3_1c * AgeG2r Crosstabulation
> > Count
> >     AgeG2r  Total
> >   1.00 2.00
> > ETHN3_1c  1.00 13 15 28
> >    2.00 3 4 7
> >    3.00 2 1 3
> > Total  18 20 38
> >
> >
> > DESCRIPTIVES AFTER RECODE
> > Young CIVILIAN AFTER
> > ETHN3_1c1
> > Frequency Percent Valid Percent Cumulative Percent
> > Valid 2.00 3 .3  60.0   60.0
> >       3.00 2 .2  40.0   100.0
> > Total      5 .5 100.0
> > Missing System 984 99.5
> > Total 989 100.0
> >
> > Old CIVILIAN AFTER
> > ETHN3_1c2
> >     Frequency Percent Valid Percent Cumulative
> > Percent
> > Valid 2.00 4 .4 80.0 80.0
> >  3.00 1 .1 20.0 100.0
> >  Total 5 .5 100.0
> > Missing System 984 99.5
> > Total  989 100.0
> >
> >
> >
> >
> > SYNTAX
> > COMMENT break each ethnicity/environment into two
> > age groups.
> >
> > COMMENT civilian young
> > IF (AgeG2r = 1 & ETHN3_1c = 1) ETHN3_1c1 = 1 .
> > EXECUTE .
> > IF (AgeG2r = 1 & ETHN3_1c = 2) ETHN3_1c1 = 2 .
> > EXECUTE .
> > IF (AgeG2r = 1 & ETHN3_1c = 3) ETHN3_1c1 = 3 .
> > EXECUTE .
> > VALUE LABEL ENV 1 'young white Citizen Only'
> > 2 'young afam citizen only'
> > 3 'young other citizen only'
> > EXECUTE.
> > FREQUENCIES
> > VARIABLES= AgeG2r ETHN3_1c ETHN3_1c1
> > /BARCHART FREQ
> > /ORDER= ANALYSIS .
> >
> > COMMENT civilian old
> > IF (AgeG2r = 2 & ETHN3_1c = 1) ETHN3_1c2 = 1 .
> > EXECUTE .
> > IF (AgeG2r = 2 & ETHN3_1c = 2) ETHN3_1c2 = 2 .
> > EXECUTE .
> > IF (AgeG2r = 2 & ETHN3_1c = 3) ETHN3_1c2 = 3 .
> > EXECUTE .
> > VALUE LABEL ENV 1 'old white Citizen Only'
> > 2 'old afam citizen only'
> > 3 'old other citizen only'
> > EXECUTE.
> > FREQUENCIES
> > VARIABLES=ETHN3_1c2
> > /BARCHART FREQ
> > /ORDER= ANALYSIS .
> >
> >
> > COMMENT military young
> > IF (AgeG2r = 1 & ETHN3_1m = 1) ETHN3_1m1 = 1 .
> > EXECUTE .
> > IF (AgeG2r = 1 & ETHN3_1m = 2) ETHN3_1m1 = 2 .
> > EXECUTE .
> > IF (AgeG2r = 1 & ETHN3_1m = 3) ETHN3_1m1 = 3 .
> > EXECUTE .
> > VALUE LABEL ENV 1 'young white military Only'
> > 2 'young afam military only'
> > 3 'young other military only'
> > EXECUTE.
> > FREQUENCIES
> > VARIABLES=ETHN3_1m1
> > /BARCHART FREQ
> > /ORDER= ANALYSIS .
> >
> > COMMENT military old
> > IF (AgeG2r = 2 & ETHN3_1m = 1) ETHN3_1m2 = 1 .
> > EXECUTE .
> > IF (AgeG2r = 2 & ETHN3_1m = 2) ETHN3_1m2 = 2 .
> > EXECUTE .
> > IF (AgeG2r = 2 & ETHN3_1m = 3) ETHN3_1m2 = 3 .
> > EXECUTE .
> > VALUE LABEL ENV 1 'old white military Only'
> > 2 'old afam military only'
> > 3 'old other military only'
> > EXECUTE.
> > FREQUENCIES
> > VARIABLES=ETHN3_1m2
> > /BARCHART FREQ
> > /ORDER= ANALYSIS .
> >
> >
> > COMMENT both young
> > IF (AgeG2r = 1 & ETHN3_1cm = 1) ETHN3_1cm1 = 1 .
> > EXECUTE .
> > IF (AgeG2r = 1 & ETHN3_1cm = 2) ETHN3_1cm1 = 2 .
> > EXECUTE .
> > IF (AgeG2r = 1 & ETHN3_1cm = 3) ETHN3_1cm1 = 3 .
> > EXECUTE .
> > VALUE LABEL ENV 1 'young white both'
> > 2 'young afam both'
> > 3 'young other both'
> > EXECUTE.
> > FREQUENCIES
> > VARIABLES=ETHN3_1cm1
> > /BARCHART FREQ
> > /ORDER= ANALYSIS .
> >
> > COMMENT both old
> > IF (AgeG2r = 2 & ETHN3_1cm = 1) ETHN3_1cm2 = 1 .
> > EXECUTE .
> > IF (AgeG2r = 2 & ETHN3_1cm = 2) ETHN3_1cm2 = 2 .
> > EXECUTE .
> > IF (AgeG2r = 2 & ETHN3_1cm = 3) ETHN3_1cm2 = 3 .
> > EXECUTE .
> > VALUE LABEL ENV 1 'old white both'
> > 2 'old afam both'
> > 3 'old other both'
> > EXECUTE.
> > FREQUENCIES
> > VARIABLES=ETHN3_1cm2
> > /BARCHART FREQ
> > /ORDER= ANALYSIS .
> >
>
>
> Cheers!
> Albert-Jan
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Did you know that 87.166253% of all statistics claim a precision of results that
> is not justified by the method employed? [HELMUT RICHTER]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
> ____________________________________________________________________________________
> Pinpoint customers who are looking for what you sell.
> http://searchmarketing.yahoo.com/
>
>
>