<?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 in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779338#M38242</link>
    <description>&lt;P&gt;Is DATE numeric or character (text)? Please run PROC CONTENTS on data set CALC and show us what it says for variable DATE.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 14:19:30 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-11-09T14:19:30Z</dc:date>
    <item>
      <title>where date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779335#M38241</link>
      <description>&lt;P&gt;&lt;FONT face="Courier New" color="#000080"&gt;&lt;STRONG&gt;I have a variable "date" in the format "jun20" (MONYY5.). I'm creating a new table, doing some calculations per month, but I can"t select just for months. What to do?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;create&lt;/FONT&gt; &lt;FONT face="Courier New" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; calc2 &lt;/FONT&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; DATE,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#800080"&gt;'00'n&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;no_default,&lt;/P&gt;
&lt;P&gt;default,&lt;/P&gt;
&lt;P&gt;total,&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; sum(default) &lt;/FONT&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; total_no_d,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; sum(no_default) &lt;/FONT&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; total_def,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; default / sum(default) &lt;/FONT&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; dist_no_d,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; no_default / sum(no_default) &lt;/FONT&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; dist_def&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; calc&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; DATE = &lt;/FONT&gt;&lt;FONT face="Courier New" color="#800080"&gt;'JUN20'&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779335#M38241</guid>
      <dc:creator>Thalitacosta</dc:creator>
      <dc:date>2021-11-09T14:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: where date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779338#M38242</link>
      <description>&lt;P&gt;Is DATE numeric or character (text)? Please run PROC CONTENTS on data set CALC and show us what it says for variable DATE.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779338#M38242</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-09T14:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: where date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779340#M38243</link>
      <description>&lt;DIV id="tinyMceEditorThalitacosta_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;type: numeric&lt;/P&gt;
&lt;P&gt;length: 4&lt;/P&gt;
&lt;P&gt;group: date&lt;/P&gt;
&lt;P&gt;format: MONYY5.&lt;/P&gt;
&lt;P&gt;Informat: YYMMDD8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779340#M38243</guid>
      <dc:creator>Thalitacosta</dc:creator>
      <dc:date>2021-11-09T14:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: where date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779341#M38244</link>
      <description>&lt;P&gt;SQL uses raw (unformatted) values for the condition, so you need to adapt for that. I guess(!) that you want the year 2020, not 1920 or so (insert usual comment about the intelligence (or lack thereof) of using 2-digit years).&lt;/P&gt;
&lt;P&gt;So change your condition to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where put(DATE,yymmn6.) = "202006"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or, other way round&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where date = '01jun2020'd&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if these are typical "monthly dates" where it is always the first.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779341#M38244</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-09T14:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: where date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779342#M38245</link>
      <description>&lt;P&gt;The key thing to remember is that when doing Boolean comparisons, such as in words, the month is equal to June 2020, the format is irrelevant. What matters is the internal representation of the date, which is an integer indicating the number of days since 01JAN1960. Now, I suspect you (like 100% of everybody else) don't know how many days that is, so SAS provides a syntax for representing June 1, 2020, and that is &lt;FONT face="courier new,courier"&gt;'01JUN2020'd&lt;/FONT&gt;. This allows humans (who think in days months and years) to communicate with SAS, which thinks in terms of the number of days since 01JAN1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, what you want to program is this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where DATE between '01JUN2020'd and '30JUN2020'd;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/where-date/m-p/779342#M38245</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-09T14:30:18Z</dc:date>
    </item>
  </channel>
</rss>

