<?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 Retain Information For a Given ID in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Retain-Information-For-a-Given-ID/m-p/757792#M239229</link>
    <description>&lt;P&gt;See Attached. Essentially, I want to have the BMI and treatment group repeated for the given ID. Then I want to assess whether the time frame was during or after by comparing DATE_1 to DATE_2. If DATE_2 occurred before the last DATE_1 for "during", then I want the time period for the X measurements to be labeled "during". If DATE_2 occurred after the first DATE_1 for "after", then I want the time period for X measurements to be labeled "after". I have attempted using the retain statement, but it doesn't seem to do what I expected it to. It seemed to have no effect on the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = working nodupkey;
 by ID PERIOD DATE_1;
 run; 

data working; 
set working; 
by ID; 
retain TRT BMI DATE_1; 
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 Jul 2021 17:12:36 GMT</pubDate>
    <dc:creator>mariko5797</dc:creator>
    <dc:date>2021-07-28T17:12:36Z</dc:date>
    <item>
      <title>Retain Information For a Given ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-Information-For-a-Given-ID/m-p/757792#M239229</link>
      <description>&lt;P&gt;See Attached. Essentially, I want to have the BMI and treatment group repeated for the given ID. Then I want to assess whether the time frame was during or after by comparing DATE_1 to DATE_2. If DATE_2 occurred before the last DATE_1 for "during", then I want the time period for the X measurements to be labeled "during". If DATE_2 occurred after the first DATE_1 for "after", then I want the time period for X measurements to be labeled "after". I have attempted using the retain statement, but it doesn't seem to do what I expected it to. It seemed to have no effect on the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = working nodupkey;
 by ID PERIOD DATE_1;
 run; 

data working; 
set working; 
by ID; 
retain TRT BMI DATE_1; 
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jul 2021 17:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-Information-For-a-Given-ID/m-p/757792#M239229</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2021-07-28T17:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Retain Information For a Given ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-Information-For-a-Given-ID/m-p/757794#M239230</link>
      <description>&lt;P&gt;I'm not sure why, but I didn't have the text tools to make the post easy to follow initially. Here's the code attempt rewritten:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = working nodupkey; 
 by ID PERIOD DATE_1; 
run; 

data working; 
 set working; 
 by ID; 
 retain TRT BMI DATE_1; 
run;
 /* also tried to retain X1, X2, X3 instead */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jul 2021 16:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-Information-For-a-Given-ID/m-p/757794#M239230</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2021-07-28T16:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Retain Information For a Given ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retain-Information-For-a-Given-ID/m-p/757814#M239233</link>
      <description>Not sure why your post didn't work but I edited it. &lt;BR /&gt;&lt;BR /&gt;Retain doesn't really work on existing variables so if you want to use retain type functionality, create a new variable to hold the values. Looking at the Excel, RETAIN is not the correct solution here. UPDATE may be more appropriate. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Jul 2021 17:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retain-Information-For-a-Given-ID/m-p/757814#M239233</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-28T17:14:30Z</dc:date>
    </item>
  </channel>
</rss>

