<?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: where date(YYMMDDN8.) before 20180430 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/where-date-YYMMDDN8-before-20180430/m-p/465214#M118653</link>
    <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; my&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; datecolumn&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; '30APR2018'd &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Date values in SAS are stored as numeric&lt;SPAN&gt;value that represents the number of days from January 1, 1960. DATEPART() is used to extract date from Datetime values. Since you have only date values you don't need datepart()&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 25 May 2018 20:12:20 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2018-05-25T20:12:20Z</dc:date>
    <item>
      <title>where date(YYMMDDN8.) before 20180430</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-date-YYMMDDN8-before-20180430/m-p/465211#M118650</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;quick question, I want to count the number of observations in a table where the date is before another date. The format of my date column is&amp;nbsp;&lt;SPAN&gt;YYMMDDN8. For example, if I want to count the number of observations that are before 20180430 I would have something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select count(*)
from my.table
where datepart(datecolumn) &amp;lt; 20180430 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 20:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-date-YYMMDDN8-before-20180430/m-p/465211#M118650</guid>
      <dc:creator>x2PSx</dc:creator>
      <dc:date>2018-05-25T20:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: where date(YYMMDDN8.) before 20180430</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-date-YYMMDDN8-before-20180430/m-p/465213#M118652</link>
      <description>&lt;P&gt;You could change the date value to a standard SAS date value. table values are unchanged just makes the where condition easier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select count(*)
from my.table
where datepart(datecolumn) &amp;lt; '30APR2018'd ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 May 2018 20:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-date-YYMMDDN8-before-20180430/m-p/465213#M118652</guid>
      <dc:creator>DanielLangley</dc:creator>
      <dc:date>2018-05-25T20:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: where date(YYMMDDN8.) before 20180430</title>
      <link>https://communities.sas.com/t5/SAS-Programming/where-date-YYMMDDN8-before-20180430/m-p/465214#M118653</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; my&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; datecolumn&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; '30APR2018'd &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Date values in SAS are stored as numeric&lt;SPAN&gt;value that represents the number of days from January 1, 1960. DATEPART() is used to extract date from Datetime values. Since you have only date values you don't need datepart()&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 20:12:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/where-date-YYMMDDN8-before-20180430/m-p/465214#M118653</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-05-25T20:12:20Z</dc:date>
    </item>
  </channel>
</rss>

