<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating an indicator from information in a cluster in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169387#M32500</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is your final output ？&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Jul 2014 15:11:33 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2014-07-08T15:11:33Z</dc:date>
    <item>
      <title>Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169380#M32493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to create a variable called 'household composition' using survey data. This is based on four indicators&lt;/P&gt;&lt;P&gt;1) household ID (HID)&lt;/P&gt;&lt;P&gt;2) father ID (FID)&lt;/P&gt;&lt;P&gt;3) mother ID (MID)&lt;/P&gt;&lt;P&gt;4) spouse ID (SID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example of the data.&amp;nbsp; PID is participant ID.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PID&amp;nbsp;&amp;nbsp; HID&amp;nbsp;&amp;nbsp; FID&amp;nbsp;&amp;nbsp;&amp;nbsp; MID&amp;nbsp;&amp;nbsp; SID&lt;/P&gt;&lt;P&gt;101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 102&lt;/P&gt;&lt;P&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101&lt;/P&gt;&lt;P&gt;103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . &lt;/P&gt;&lt;P&gt;201&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;202&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 201&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;301&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 302&lt;/P&gt;&lt;P&gt;302&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 301&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;401&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . &lt;/P&gt;&lt;P&gt;501&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 502&lt;/P&gt;&lt;P&gt;502&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 501&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to say:&lt;/P&gt;&lt;P&gt;- the household composition of household 1 (hid=1) is a two parent family [mom is 102, dad is 101, child is 103]&lt;/P&gt;&lt;P&gt;- the household composition of household 2 (hid=2) is a single parent family (dad is 201, kid is 202]&lt;/P&gt;&lt;P&gt;- the household composition of household 3 (hid=3) is a couple (301 and 302 are together, no kids).&amp;nbsp; household 5 are also a couple.&lt;/P&gt;&lt;P&gt;- the household composition of household 4 (hid=4) is single person (id=401)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do this and keep data in a long format?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 18:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169380#M32493</guid>
      <dc:creator>KMack</dc:creator>
      <dc:date>2014-07-07T18:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169381#M32494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Will you need this code to be applied to all records of each household or only one? If the former there will be a step to summarize the data and a second to merge it back to the original.&lt;/P&gt;&lt;P&gt;What should your composition variable look like? A single character or digit? Do you need to distinguish between single parent families with only a father and only a mother or just single parent?&lt;/P&gt;&lt;P&gt;It appears that father ids always end in 1, mother ids with 2 and anything else is a child. Is that correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I don't want to use survey software that outputs data that way if the household is a single response to a survey...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 19:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169381#M32494</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-07-07T19:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169382#M32495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the data sorted this way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 19:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169382#M32495</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-07T19:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169383#M32496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code needs to be applied to all individuals in the house, not just the household itself.&lt;/P&gt;&lt;P&gt;The composition variable will be a digit; it does not matter if a single parent household is headed by a father or a mother, just that it's a single parent household.&lt;/P&gt;&lt;P&gt;Unfortunately, fathers' codes do not always end in 01.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 20:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169383#M32496</guid>
      <dc:creator>KMack</dc:creator>
      <dc:date>2014-07-07T20:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169384#M32497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes - the data are sorted as i wrote them.&amp;nbsp; thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 20:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169384#M32497</guid>
      <dc:creator>KMack</dc:creator>
      <dc:date>2014-07-07T20:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169385#M32498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll have to merge this back in with the original data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length composition $20.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by hid notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain flag_child flag_married;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.hid then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call missing (flag_child, flag_married);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (not missing(fid)) or (not missing(mid)) then flag_child=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(sid) then flag_married=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.hid and last.hid then composition='Single Person';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if last.hid and flag_child=1 and flag_married=. then composition='Single Parent';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if last.hid and flag_child=1 and flag_married=1 then composition='Two Parent Family';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if last.hid and flag_child=. and flag_married=1 then composition='Couple';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.hid then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *keep hid composition;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 20:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169385#M32498</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-07T20:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169386#M32499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So how to do you tell that a pid is a parent not a child?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2014 20:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169386#M32499</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-07-07T20:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an indicator from information in a cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169387#M32500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is your final output ？&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jul 2014 15:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-indicator-from-information-in-a-cluster/m-p/169387#M32500</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-07-08T15:11:33Z</dc:date>
    </item>
  </channel>
</rss>

