<?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: how to display 2016/02/20 as it is in output in sas AND how to use first. and last. to get outpu in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329417#M73694</link>
    <description>&lt;P&gt;Post test data in the form of a datastep. &amp;nbsp;I can't tell from that wether the dates are numeric dates or text for example.&lt;/P&gt;
&lt;P&gt;This is just a guess (that they are number) not tested (as no test data in a datastep):&lt;/P&gt;
&lt;PRE&gt;data want (drop=sd);  
  set have (rename=(start_date=sd));
  by id;
  if first.id then start_date=sd;
  if last.id then do;
    end_date=sd;
    output;
  end;
  format start_date end_date yymmdd10.;
run;&lt;/PRE&gt;
&lt;P&gt;Note your results table does not match your test data - no sex, and trt.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2017 13:59:59 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-02-02T13:59:59Z</dc:date>
    <item>
      <title>how to display 2016/02/20 as it is in output in sas AND how to use first. and last. to get output?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329413#M73692</link>
      <description>&lt;P&gt;dataset:&lt;/P&gt;&lt;P&gt;id &amp;nbsp; &amp;nbsp;trt start_end&lt;/P&gt;&lt;P&gt;101 TA 2012/02/20&lt;/P&gt;&lt;P&gt;101 TA 2012/03/12&lt;/P&gt;&lt;P&gt;102 TB 2014/03/13&lt;/P&gt;&lt;P&gt;103 TC 2014/03/14&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result dataset :&lt;/P&gt;&lt;P&gt;id &amp;nbsp; &amp;nbsp;sex start_date &amp;nbsp; &amp;nbsp; end_date&lt;/P&gt;&lt;P&gt;101 M &amp;nbsp; &amp;nbsp;2012/02/20 &amp;nbsp;2012/03/12&lt;/P&gt;&lt;P&gt;102 F &amp;nbsp; &amp;nbsp; 2014/03/13 &amp;nbsp;2014/03/13&lt;/P&gt;&lt;P&gt;103 M &amp;nbsp; &amp;nbsp;2014/03/14 &amp;nbsp;2014/03/14&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 13:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329413#M73692</guid>
      <dc:creator>mssh2712</dc:creator>
      <dc:date>2017-02-02T13:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to display 2016/02/20 as it is in output in sas AND how to use first. and last. to get outpu</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329417#M73694</link>
      <description>&lt;P&gt;Post test data in the form of a datastep. &amp;nbsp;I can't tell from that wether the dates are numeric dates or text for example.&lt;/P&gt;
&lt;P&gt;This is just a guess (that they are number) not tested (as no test data in a datastep):&lt;/P&gt;
&lt;PRE&gt;data want (drop=sd);  
  set have (rename=(start_date=sd));
  by id;
  if first.id then start_date=sd;
  if last.id then do;
    end_date=sd;
    output;
  end;
  format start_date end_date yymmdd10.;
run;&lt;/PRE&gt;
&lt;P&gt;Note your results table does not match your test data - no sex, and trt.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 13:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329417#M73694</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-02T13:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to display 2016/02/20 as it is in output in sas AND how to use first. and last. to get outpu</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329418#M73695</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data date;
   input id:$3. trt:$2. start_end:yymmdd.;
   format start_end yymmdds10.;
   cards;
101 TA 2012/02/20
101 TA 2012/03/12
102 TB 2014/03/13
103 TC 2014/03/14
;;;;
   run;
proc print;
   run;
proc summary nway;
   class id trt;
   var start_end;
   output out=date2(drop=_:) min=start_date max=end_date;
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG title="Capture.PNG" alt="Capture.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/7070iA5B770AD42C019C6/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 14:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329418#M73695</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-02-02T14:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to display 2016/02/20 as it is in output in sas AND how to use first. and last. to get outpu</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329501#M73725</link>
      <description>&lt;P&gt;Well done. Thanks for your reply.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 16:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-display-2016-02-20-as-it-is-in-output-in-sas-AND-how-to/m-p/329501#M73725</guid>
      <dc:creator>mssh2712</dc:creator>
      <dc:date>2017-02-02T16:41:57Z</dc:date>
    </item>
  </channel>
</rss>

