Date: Thu, 29 Sep 2005 10:43:20 -0400
Reply-To: Eric_Duguay@ssss.gouv.qc.ca
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Eric Duguay <Eric_Duguay@ssss.gouv.qc.ca>
Subject: re : recoding
Content-type: text/plain; charset=US-ASCII
Maybe this strucure would be more appropriate for your need. Im just
surprise that you are using range as you said that you have a string
variable. This exemple is again quite basic and Im sure someone in the=
list can come with a fancy macro.
COMPUTE va3 =3D 0 .
EXECUTE .
DO IF (bb_12 =3D 1).
RECODE
bb_12br
(11=3D1) (83=3D1) (95 thru 97=3D1) (189=3D1) (135=3D1) (137=3D1) =
INTO v3.
END IF.
EXECUTE.
DO IF (bb_12 =3D 2 | (bb_12 >=3D 7 & bb_12 <=3D 9)).
RECODE
bb_12br
(1=3D2) (10=3D2) (57=3D2) (190=3D2) (106=3D2) (150=3D2) INTO v3=
.
END IF.
EXECUTE.
Eric
------------------------------------------------------------------------
Thank you, this seems exactly right. I only have an SPSS version 10.0
syntax book right now...having trouble figuring out how to separate a l=
ist
of values:
e.g
if (bb_12=3D1 and bb_12br=3D11 83 95 96 97 135 189 137) va3=3D1.
if (bb_12=3D2 7 THRU 9 and bb_12br=3D1 10 57 190 106 150) va3=3D2.
I think I can use "THRU" to express a range, but do I use commas, slash=
es,
or what to separate multiple values from one another?
Jean
Jean Campbell, MPA
campbel@u.arizona.edu
520/626-1085
-----Original Message-----
From: Eric_Duguay@ssss.gouv.qc.ca [mailto:Eric_Duguay@ssss.gouv.qc.ca]
Sent: Wednesday, September 28, 2005 12:10 PM
To: Jean Campbell
Subject: R=E9f. : Recoding
Hi!
Here a template that you will maybe find usefull. Its very basic but y=
ou
can adapt it to your needs.
****** initialising va3 *****
COMPUTE va3 =3D 0 .
EXECUTE .
****** recoding with 2 variable *********
if (va1=3D5 and va2=3D'city') va3 =3D1.
if (va1=3D10 and va2=3D'city') va3 =3D2.
if (va1=3D10 and va2=3D'town') va3 =3D3.
if (va1=3D20 and va2=3D'town') va3 =3D3.
EXECUTE .
Hope it help
Eric
----------------------------------------------------------------------
Hello listers,
I am a fairly new user without too much statistical training, and am tr=
ying
to do some recoding. Would appreciate any help on solving this seeming=
ly
simple problem, have found no reference in my manual.
I have two separate variables that list a person's profession, one is a=
string variable and the other is numeric. I want to recode both variab=
les
into one new variable "profession." But so far I can only recode one
variable at a time into a new variable...
Any help?
Jean
Jean Campbell, MPA
campbel@u.arizona.edu
520/626-108