<?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 longitudinal dataset: assigning a variable value for all records of an individual in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100043#M5132</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset with multiple records per person (because each record represents a different year). I want to group people in this dataset by a value they had in 1996 with a new variable.&lt;/P&gt;&lt;P&gt;My code is: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;group=.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if year= 1996 and y=0 then group=0;&lt;/P&gt;&lt;P&gt;if year= 1996 and y=1 then group=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that this just assigns a value to my new variable group in 1996 and this new variable has a missing value for all other years. I would like that same value to be assigned for every record of the same individual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions about how to go about this?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 06 Apr 2013 18:50:21 GMT</pubDate>
    <dc:creator>Laura123</dc:creator>
    <dc:date>2013-04-06T18:50:21Z</dc:date>
    <item>
      <title>longitudinal dataset: assigning a variable value for all records of an individual</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100043#M5132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset with multiple records per person (because each record represents a different year). I want to group people in this dataset by a value they had in 1996 with a new variable.&lt;/P&gt;&lt;P&gt;My code is: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;group=.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if year= 1996 and y=0 then group=0;&lt;/P&gt;&lt;P&gt;if year= 1996 and y=1 then group=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that this just assigns a value to my new variable group in 1996 and this new variable has a missing value for all other years. I would like that same value to be assigned for every record of the same individual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions about how to go about this?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 18:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100043#M5132</guid>
      <dc:creator>Laura123</dc:creator>
      <dc:date>2013-04-06T18:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: longitudinal dataset: assigning a variable value for all records of an individual</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100044#M5133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look up the retain statement. &lt;/P&gt;&lt;P&gt;Use it at the top of your datastep after set and before the if logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;retain group;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 19:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100044#M5133</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-06T19:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: longitudinal dataset: assigning a variable value for all records of an individual</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100045#M5134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If 1996 is always the first year, the Fareeza's suggestion may be all you need.&amp;nbsp; Otherwise, the following method will work whether 1996 is first, somewhere else, or not present at all:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id year y;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 1995 0&lt;/P&gt;&lt;P&gt;1 1996 1&lt;/P&gt;&lt;P&gt;1 1997 0&lt;/P&gt;&lt;P&gt;2 1996 0&lt;/P&gt;&lt;P&gt;2 1997 1&lt;/P&gt;&lt;P&gt;2 1998 1&lt;/P&gt;&lt;P&gt;3 1995 1&lt;/P&gt;&lt;P&gt;3 1998 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.id);&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 id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if year eq 1996 then group=y;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.id);&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 id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 20:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100045#M5134</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-04-06T20:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: longitudinal dataset: assigning a variable value for all records of an individual</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100046#M5135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to both of you for your suggestions!&amp;nbsp; It's true that not all individuals had an observation in 1996, which is something I had not previously considered when approaching this particular problem. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Apr 2013 16:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/longitudinal-dataset-assigning-a-variable-value-for-all-records/m-p/100046#M5135</guid>
      <dc:creator>Laura123</dc:creator>
      <dc:date>2013-04-07T16:41:57Z</dc:date>
    </item>
  </channel>
</rss>

