<?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 Selecting first non-missing value for each subject in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358074#M274351</link>
    <description>&lt;P&gt;I have a dataset in which i need to identify the first non missing subject within a dose.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;subject date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dose&lt;BR /&gt;&lt;STRONG&gt;10002 1/27/2015 10MG&lt;/STRONG&gt;&lt;BR /&gt;10002 2/24/2015 10MG&lt;BR /&gt;&lt;STRONG&gt;10002 6/1/2015 &amp;nbsp; 20MG&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;10002 9/29/2015 10MG&lt;/STRONG&gt;&lt;BR /&gt;10002 1/24/2016 10MG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want my final dataset to look like below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;subject &amp;nbsp; &amp;nbsp; date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dose&lt;BR /&gt;10002 &amp;nbsp; &amp;nbsp;1/27/2015 &amp;nbsp; 10MG&lt;BR /&gt;10002 &amp;nbsp; &amp;nbsp;6/1/2015 &amp;nbsp; &amp;nbsp; 20MG&lt;BR /&gt;10002 &amp;nbsp; &amp;nbsp;9/29/2015 &amp;nbsp; 10MG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any particular way to do this? If i do first.dose, its giving me only first 2 records of my final dataset.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 May 2017 00:06:12 GMT</pubDate>
    <dc:creator>gp123</dc:creator>
    <dc:date>2017-05-12T00:06:12Z</dc:date>
    <item>
      <title>Selecting first non-missing value for each subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358074#M274351</link>
      <description>&lt;P&gt;I have a dataset in which i need to identify the first non missing subject within a dose.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;subject date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dose&lt;BR /&gt;&lt;STRONG&gt;10002 1/27/2015 10MG&lt;/STRONG&gt;&lt;BR /&gt;10002 2/24/2015 10MG&lt;BR /&gt;&lt;STRONG&gt;10002 6/1/2015 &amp;nbsp; 20MG&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;10002 9/29/2015 10MG&lt;/STRONG&gt;&lt;BR /&gt;10002 1/24/2016 10MG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want my final dataset to look like below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;subject &amp;nbsp; &amp;nbsp; date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dose&lt;BR /&gt;10002 &amp;nbsp; &amp;nbsp;1/27/2015 &amp;nbsp; 10MG&lt;BR /&gt;10002 &amp;nbsp; &amp;nbsp;6/1/2015 &amp;nbsp; &amp;nbsp; 20MG&lt;BR /&gt;10002 &amp;nbsp; &amp;nbsp;9/29/2015 &amp;nbsp; 10MG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any particular way to do this? If i do first.dose, its giving me only first 2 records of my final dataset.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 00:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358074#M274351</guid>
      <dc:creator>gp123</dc:creator>
      <dc:date>2017-05-12T00:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting first non-missing value for each subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358076#M274352</link>
      <description>&lt;PRE&gt;data have;
  input subject date mmddyy10. dose $;
  format date mmddyy10.;
  cards;
10002 1/27/2015 10MG
10002 2/24/2015 10MG
10002 6/1/2015   20MG
10002 9/29/2015 10MG
10002 1/24/2016 10MG
;

data want;
  set have;
  by subject dose notsorted;
  if first.dose;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 00:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358076#M274352</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-12T00:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting first non-missing value for each subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358077#M274353</link>
      <description>&lt;P&gt;Thanks Art. But this gives me only 2 records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;subject &amp;nbsp; &amp;nbsp; date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dose&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;10002 &amp;nbsp; &amp;nbsp;1/27/2015 &amp;nbsp; 10MG&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;10002 &amp;nbsp; &amp;nbsp;6/1/2015 &amp;nbsp; &amp;nbsp; 20MG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need the first non missing record every time the dose changes.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 00:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358077#M274353</guid>
      <dc:creator>gp123</dc:creator>
      <dc:date>2017-05-12T00:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting first non-missing value for each subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358078#M274354</link>
      <description>&lt;P&gt;You're doing something other than what I did. I get all 3 records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible that you sorted your file before running&amp;nbsp;the code I suggested?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 00:29:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358078#M274354</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-12T00:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting first non-missing value for each subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358083#M274355</link>
      <description>&lt;P&gt;Yes, you are right. I had sorted my dataset before. I corrected it and it gives me 3 records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 01:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-first-non-missing-value-for-each-subject/m-p/358083#M274355</guid>
      <dc:creator>gp123</dc:creator>
      <dc:date>2017-05-12T01:14:06Z</dc:date>
    </item>
  </channel>
</rss>

