<?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 How to create a variable  based on missing date information in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-based-on-missing-date-information/m-p/286304#M58692</link>
    <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I need to create a variable(date1) based on date variable &amp;nbsp;missing information. In the second OBS date is missing and third OBS Month and date missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp;&amp;nbsp;date&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; 2012-05-01&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; 2012-05&lt;BR /&gt;3 &amp;nbsp; &amp;nbsp; 2012&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;output needed.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;id&amp;nbsp; &amp;nbsp;&amp;nbsp;date1&lt;BR /&gt;1&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; D&lt;BR /&gt;3 &amp;nbsp; &amp;nbsp; M&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jul 2016 01:42:30 GMT</pubDate>
    <dc:creator>knveraraju91</dc:creator>
    <dc:date>2016-07-22T01:42:30Z</dc:date>
    <item>
      <title>How to create a variable  based on missing date information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-based-on-missing-date-information/m-p/286304#M58692</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I need to create a variable(date1) based on date variable &amp;nbsp;missing information. In the second OBS date is missing and third OBS Month and date missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp;&amp;nbsp;date&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; 2012-05-01&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; 2012-05&lt;BR /&gt;3 &amp;nbsp; &amp;nbsp; 2012&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;output needed.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;id&amp;nbsp; &amp;nbsp;&amp;nbsp;date1&lt;BR /&gt;1&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; D&lt;BR /&gt;3 &amp;nbsp; &amp;nbsp; M&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 01:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-based-on-missing-date-information/m-p/286304#M58692</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2016-07-22T01:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable  based on missing date information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-based-on-missing-date-information/m-p/286307#M58695</link>
      <description>&lt;P&gt;Assuming your date should always be in the form YYYY-MM-DD the use LENGTHN to determine which fields are missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In record 3, both month and day are missing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 01:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-based-on-missing-date-information/m-p/286307#M58695</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-22T01:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable  based on missing date information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-based-on-missing-date-information/m-p/286322#M58702</link>
      <description>&lt;P&gt;You could count the words, as separated by "-"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id    date :$10.;
datalines;
1     2012-05-01
2     2012-05
3     2012
;

data want;
set have;
date1 = choosec(countw(date, "-"),"M", "D", " ");
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2016 04:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-based-on-missing-date-information/m-p/286322#M58702</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-22T04:16:44Z</dc:date>
    </item>
  </channel>
</rss>

