LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2009)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: grigoris <grigoris.argeros@GMAIL.COM>
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&nbsp; cceduclhs&nbsp; cceduchs&nbsp; cceducsomecoll&nbsp; cceduccollege<br> &nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8405&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4239&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5007&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4784<br> &nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1640&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2312&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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> &nbsp;/MAKE Number<br> &nbsp; FROM cceduclhs cceduchs cceducsomecoll cceduccollege<br> &nbsp;/INDEX = cceduc(4)<br> &nbsp;/KEEP&nbsp; =&nbsp; region<br> &nbsp;/NULL&nbsp; = KEEP.<br><br> &nbsp;<br> Variables to Cases<br> |-----------------------------|---------------------------|<br> |Output Created&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |04-MAY-2009 12:31:33&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br> |-----------------------------|---------------------------|<br> &nbsp;<br> Generated Variables<br> |------|------|<br> |Name&nbsp; |Label |<br> |------|------|<br> |cceduc|&lt;none&gt;|<br> |Number|&lt;none&gt;|<br> |------|------|<br> &nbsp;<br> Processing Statistics<br> |-------------|-|<br> |Variables In |5|<br> |Variables Out|3|<br> |-------------|-|<br><br> &nbsp;<br> LIST.<br> |-----------------------------|---------------------------|<br> |Output Created&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |04-MAY-2009 12:31:33&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br> |-----------------------------|---------------------------|<br> region cceduc Number<br><br> &nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; 8405<br> &nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp; 4239<br> &nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp; 5007<br> &nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp; 4784<br> &nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; 2888<br> &nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp; 1640<br> &nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp; 2312<br> &nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp; 1638<br><br> Number of cases read:&nbsp; 8&nbsp;&nbsp;&nbsp; Number of cases listed:&nbsp; 8<br><br> </font></tt>=============================<br> APPENDIX: Test data, and code<br> =============================<br> <tt><font size=2>DATA LIST LIST/<br> &nbsp;&nbsp; region&nbsp; cceduclhs&nbsp; cceduchs&nbsp; cceducsomecoll&nbsp; cceduccollege.<br> BEGIN DATA<br> &nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8405&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4239&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5007&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4784<br> &nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1640&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2312&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1638<br> END DATA.<br><br> FORMATS region TO cceduccollege (F4).<br><br> LIST.<br><br> VARSTOCASES&nbsp; <br> &nbsp;/MAKE Number <br> &nbsp; FROM cceduclhs cceduchs cceducsomecoll cceduccollege<br> &nbsp;/INDEX = cceduc(4)<br> &nbsp;/KEEP&nbsp; =&nbsp; region<br> &nbsp;/NULL&nbsp; = 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


Back to: Top of message | Previous page | Main SPSSX-L page