Date: Mon, 4 May 2009 12:36:03 -0400
Reply-To: Richard Ristow <wrristow@mindspring.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <wrristow@mindspring.com>
Subject: Re: creating a new variable from a series of variables
In-Reply-To: <23361101.post@talk.nabble.com>
Content-Type: text/html; charset="us-ascii"
<html>
<body>
At 07:42 PM 5/3/2009, grigoris wrote:<br><br>
<blockquote type=cite class=cite cite="">I have a dataset that looks like
this:<br>
</blockquote><tt><font size=2>region cceduclhs cceduchs
cceducsomecoll cceduccollege<br>
1
8405
4239
5007
4784<br>
2
2888
1640
2312
1638<br><br>
</font></tt><blockquote type=cite class=cite cite="">The above units
except for the region variable are individuals. For example,<br>
for cceduclhs in region 1, we have 8,405 individuals with less than a
high<br>
school diploma.<br><br>
I want to recode the above variables, except region, into an ordinal
that<br>
hopefully will look like this:<br><br>
cceduc<br>
lhs=1<br>
hs=2<br>
some college=3<br>
college=4</blockquote><br>
I'm not sure what you want, but maybe this?<br><br>
<tt><font size=2>VARSTOCASES<br>
/MAKE Number<br>
FROM cceduclhs cceduchs cceducsomecoll cceduccollege<br>
/INDEX = cceduc(4)<br>
/KEEP = region<br>
/NULL = KEEP.<br><br>
<br>
Variables to Cases<br>
|-----------------------------|---------------------------|<br>
|Output
Created
|04-MAY-2009 12:31:33 |<br>
|-----------------------------|---------------------------|<br>
<br>
Generated Variables<br>
|------|------|<br>
|Name |Label |<br>
|------|------|<br>
|cceduc|<none>|<br>
|Number|<none>|<br>
|------|------|<br>
<br>
Processing Statistics<br>
|-------------|-|<br>
|Variables In |5|<br>
|Variables Out|3|<br>
|-------------|-|<br><br>
<br>
LIST.<br>
|-----------------------------|---------------------------|<br>
|Output
Created
|04-MAY-2009 12:31:33 |<br>
|-----------------------------|---------------------------|<br>
region cceduc Number<br><br>
1 1
8405<br>
1 2
4239<br>
1 3
5007<br>
1 4
4784<br>
2 1
2888<br>
2 2
1640<br>
2 3
2312<br>
2 4
1638<br><br>
Number of cases read: 8 Number of cases
listed: 8<br><br>
</font></tt>=============================<br>
APPENDIX: Test data, and code<br>
=============================<br>
<tt><font size=2>DATA LIST LIST/<br>
region cceduclhs cceduchs
cceducsomecoll cceduccollege.<br>
BEGIN DATA<br>
1
8405
4239
5007
4784<br>
2
2888
1640
2312
1638<br>
END DATA.<br><br>
FORMATS region TO cceduccollege (F4).<br><br>
LIST.<br><br>
VARSTOCASES <br>
/MAKE Number <br>
FROM cceduclhs cceduchs cceducsomecoll cceduccollege<br>
/INDEX = cceduc(4)<br>
/KEEP = region<br>
/NULL = KEEP.<br><br>
LIST.<br>
</font></body>
<br>
</html>
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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
|