<?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 require the &amp;quot;AUG2022&amp;quot; date? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874707#M345613</link>
    <description>&lt;P&gt;You cannot have a date without a day of the month.&lt;/P&gt;
&lt;P&gt;You could pick any day of the month, but normally people just use the first of the month.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if scrdate_n in ('01AUG2022'd);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if you really want to test if SCRDATE_N is ANY day in that month then you probably need to work harder.&lt;/P&gt;
&lt;P&gt;Try one of these instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if put(scrdate_n,monyy7.)  in ('AUG2022');
if intnx('month',scrdate_n,0,'b') in ('01AUG2022'd);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 09 May 2023 17:05:43 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-05-09T17:05:43Z</dc:date>
    <item>
      <title>How to require the "AUG2022" date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874704#M345611</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I would like to get the month of "AUG2022" in the variable "scrdate_n."&amp;nbsp; The variable format is&amp;nbsp;MONYY7.&amp;nbsp; &amp;nbsp;Please guild me how; thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 16:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874704#M345611</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-05-09T16:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to require the "AUG2022" date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874706#M345612</link>
      <description>&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if scrdate_n in ('AUG2022'd);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;The log window shows an error message,&amp;nbsp;ERROR: Invalid date/time/datetime constant 'AUG2022'd.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 17:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874706#M345612</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-05-09T17:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to require the "AUG2022" date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874707#M345613</link>
      <description>&lt;P&gt;You cannot have a date without a day of the month.&lt;/P&gt;
&lt;P&gt;You could pick any day of the month, but normally people just use the first of the month.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if scrdate_n in ('01AUG2022'd);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if you really want to test if SCRDATE_N is ANY day in that month then you probably need to work harder.&lt;/P&gt;
&lt;P&gt;Try one of these instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if put(scrdate_n,monyy7.)  in ('AUG2022');
if intnx('month',scrdate_n,0,'b') in ('01AUG2022'd);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 May 2023 17:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874707#M345613</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-09T17:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to require the "AUG2022" date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874708#M345614</link>
      <description>I know the day I put was wrong. how to correct it?  I only need the month.</description>
      <pubDate>Tue, 09 May 2023 17:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874708#M345614</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-05-09T17:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to require the "AUG2022" date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874709#M345615</link>
      <description>&lt;P&gt;I recommend you check out the&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/ds2pg/n02zpqz4j5u3j9n1t0i95ncqep5g.htm" target="_self"&gt;SAS Date, Time, and Datetime Values&lt;/A&gt;&amp;nbsp; documentation&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Here's an example&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.have ;
	format date monyy. ;
	do date="25jul2023"d to "10Sep2023"d by 7 ;
		output work.have ;
	end ;
run ;

data work.want ;
	set work.have ;
	put "Have : " date= date= date7. date= 8. ;
	if "01Aug2023"d &amp;lt;= date &amp;lt; "01Sep2023"d then do ;
		put "        Want : " date= date= date7. date= 8. ;
		output work.want ;
	end ;
	else
		put "  Don't Want : " date= date= date7. date= 8. ;

run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 May 2023 17:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874709#M345615</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2023-05-09T17:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to require the "AUG2022" date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874710#M345616</link>
      <description>&lt;P&gt;If you want to specify a date value you HAVE to have a day of the month.&lt;/P&gt;
&lt;P&gt;A number can only have one value.&amp;nbsp; It cannot have a range of values.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 17:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874710#M345616</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-09T17:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to require the "AUG2022" date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874714#M345619</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if scrdate_n in ('AUG2022'd);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;The log window shows an error message,&amp;nbsp;ERROR: Invalid date/time/datetime constant 'AUG2022'd.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Several ways to check if a date occurs in a given month:&lt;/P&gt;
&lt;PRE&gt;If month(scrdate_n)=8 and year(scrdate_n)=2022 then ....

if put(scrdate_n,monyy7.)='AUG2022' then ...
 
if intnx('month',scrdate_n,0,'B') = '01AUG2022'd then ...&lt;/PRE&gt;
&lt;P&gt;for 3 examples.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 17:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-require-the-quot-AUG2022-quot-date/m-p/874714#M345619</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-05-09T17:32:49Z</dc:date>
    </item>
  </channel>
</rss>

