<?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: Date extract in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721251#M223526</link>
    <description>&lt;P&gt;I would store year as a number with length 3. This allows years up to 8192, consumes the least space, and can be used in calculations or functions without conversion.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2021 12:18:31 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-02-23T12:18:31Z</dc:date>
    <item>
      <title>Date extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721246#M223521</link>
      <description>If date is 2019/un/un.how can I get 2019 or 11/un/un.from this how we can extract 11</description>
      <pubDate>Tue, 23 Feb 2021 11:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721246#M223521</guid>
      <dc:creator>Sowmya12</dc:creator>
      <dc:date>2021-02-23T11:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721248#M223523</link>
      <description>&lt;P&gt;11 is not a year (2011 would be).&lt;/P&gt;
&lt;P&gt;If you don't even know the &lt;EM&gt;order&lt;/EM&gt; of the parts (YMD, DMY or MDY), you can't solve this.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 11:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721248#M223523</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-23T11:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Date extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721249#M223524</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/370687"&gt;@Sowmya12&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the first part of your data is always the year, then the below might help (assuming your date is character, based on what you've shown).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;scan()&lt;/FONT&gt; function selects part of string that is separated by a specific character(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input my_date : $char10.;

   datalines;
2019/un/un
11/un/un
;


data want;
   set have;
   
   y = scan(my_date,1,'/');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 12:07:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721249#M223524</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2021-02-23T12:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Date extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721250#M223525</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/370687"&gt;@Sowmya12&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I meant to add a &lt;FONT face="courier new,courier"&gt;length&lt;/FONT&gt; statement to give &lt;FONT face="courier new,courier"&gt;y&lt;/FONT&gt; a length of 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 12:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721250#M223525</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2021-02-23T12:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Date extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721251#M223526</link>
      <description>&lt;P&gt;I would store year as a number with length 3. This allows years up to 8192, consumes the least space, and can be used in calculations or functions without conversion.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 12:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721251#M223526</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-23T12:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721254#M223527</link>
      <description>&lt;P&gt;True.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 12:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-extract/m-p/721254#M223527</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2021-02-23T12:42:18Z</dc:date>
    </item>
  </channel>
</rss>

