<?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 a new variable where all rows with the same id display the first value for that id in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651604#M195522</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/331253"&gt;@ESpiel&lt;/a&gt;&amp;nbsp; Alright please try this-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  by id;
  retain need;
  if first.id then need=.;
  if not need and indicator=1 then need=DATE_HAVE; 
  format need mmddyy10.; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 29 May 2020 00:22:06 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-05-29T00:22:06Z</dc:date>
    <item>
      <title>Creating a new variable where all rows with the same id display the first value for that id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651589#M195513</link>
      <description>&lt;P&gt;My data contains many rows, with multiple rows for some ids. I would like to create a new date variable based on a date column I have, such that all rows with the same id will display the EARLIEST date for that id. I've attached an example of what I mean.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the best way to accomplish this? Do I need to use PROC SQL and a join, or is there an easy way to do this in SAS?&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 23:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651589#M195513</guid>
      <dc:creator>ESpiel</dc:creator>
      <dc:date>2020-05-28T23:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable where all rows with the same id display the first value for that id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651600#M195518</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  want;
 set have;
 by id;
 retain need;
 if first.id then need=date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2020 23:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651600#M195518</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-28T23:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable where all rows with the same id display the first value for that id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651602#M195520</link>
      <description>&lt;P&gt;Sorry, I realized after trying your solution that there is one more element I forgot in the sample. I uploaded a new one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is it may not actually be the earliest date for that id in the whole dataset, but I need the earliest date for each id where a certain indicator=1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code doesn't work, but the idea would be something similar to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  by id;
  retain need;
  if first.id AND indicator=1 then need=date;&lt;BR /&gt;  else need=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2020 00:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651602#M195520</guid>
      <dc:creator>ESpiel</dc:creator>
      <dc:date>2020-05-29T00:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable where all rows with the same id display the first value for that id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651604#M195522</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/331253"&gt;@ESpiel&lt;/a&gt;&amp;nbsp; Alright please try this-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  by id;
  retain need;
  if first.id then need=.;
  if not need and indicator=1 then need=DATE_HAVE; 
  format need mmddyy10.; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2020 00:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-where-all-rows-with-the-same-id-display/m-p/651604#M195522</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-29T00:22:06Z</dc:date>
    </item>
  </channel>
</rss>

