<?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: should the date in the intnx functiointn  be in date format? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378975#M91154</link>
    <description>&lt;P&gt;sdc_final is benchmark and m_fegg is event.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2017 13:12:50 GMT</pubDate>
    <dc:creator>lixuan</dc:creator>
    <dc:date>2017-07-25T13:12:50Z</dc:date>
    <item>
      <title>should the date in the intnx function  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378619#M91039</link>
      <description>&lt;P&gt;Hi, I test the the numeric format and the date format used in intnx funtion, and found the results are &amp;nbsp;the same . why? if it's meanless , what is the usage of date formate? &amp;nbsp;I also &amp;nbsp;dont understand &amp;nbsp;the underlying rule of &amp;nbsp;intnx function, how &amp;nbsp;could it realize the time without date format? Thanks &amp;amp; regards.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 09:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378619#M91039</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T09:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx function  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378620#M91040</link>
      <description>&lt;P&gt;The formats control how values are&amp;nbsp;&lt;EM&gt;displayed&lt;/EM&gt;, not how they are&amp;nbsp;&lt;EM&gt;calculated&lt;/EM&gt;. The functions always work with the raw values.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 09:37:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378620#M91040</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-24T09:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx function  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378622#M91041</link>
      <description>&lt;P&gt;OK, I see ,then It's unnecessary to change the formate before I use the intnx funtion. Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 09:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378622#M91041</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T09:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378624#M91042</link>
      <description>&lt;P&gt;This is basic SAS knowledge:&lt;/P&gt;
&lt;P&gt;Dates and times are numbers since a certain timepoint. &amp;nbsp;A date is the number of days since 01Jan1960, a time is seconds from midnight. &amp;nbsp;To display that number in a meaningful way to the user you apply a format to it so that it displays in the way the user expects to see it. &amp;nbsp;All formula work regardless of that however so:&lt;/P&gt;
&lt;P&gt;days=today() - '01jan2017'd;&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;days=intck('days','01jan2017'd,today());&lt;/P&gt;
&lt;P&gt;Are functionally equivalent, however in most circumstances it is clearer to just use the functions all the time, especially with things like months/years with leap years and differeing days in each month and such like.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 09:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378624#M91042</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-24T09:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378626#M91044</link>
      <description>&lt;P&gt;Thanks, I ask the question because i encount a very strange thing. I used the intnx funtion like this as a 'where' conditon of sql join. The reult should be that &amp;nbsp;'b.yymm' is in the past 36 months of 'a.yymm', but some results exceeded 36 months. I dont know what happened. the veariables a.yymm and b.yymm had been &amp;nbsp;both producted by 'yymm=100*year()+month()' and the format is best12. could you help me or give me some hints? thanks a lot .&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;intnx('month',a.yymm,-36)&amp;lt;=b.yymm&amp;lt;=a.yymm&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jul 2017 10:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378626#M91044</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T10:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378628#M91046</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Post test data in the form of a datastep!!&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;We cannot see what you are working with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have YYMM format data? &amp;nbsp;if so then use input(cats(datevariable,"01"),yymmdd10.) to get a numeric SAS date, then format it as you want to see it. &amp;nbsp;I suspect your YYMM variables are not right, but I can't tell as am not looking at your machine.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 10:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378628#M91046</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-24T10:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378630#M91047</link>
      <description>&lt;P&gt;As far as SAS is concerned, the variables you are working with are not dates at all. &amp;nbsp;Dates refer to a specific day on SAS's date scale. &amp;nbsp;(Refer to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;post above for the very basic details of that.) &amp;nbsp;Your variables are simply integers to SAS. &amp;nbsp;But the good news is that these integers are easy to work with if you are referring to a time period 36 months earlier. &amp;nbsp;You could simply use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(a.yymm&amp;nbsp;- 300) &amp;lt;= b.yymm &amp;lt;= a.yymm&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, this won't screen out illegal values (such as b.yymm&amp;nbsp;= 1515), but that won't occur if your variables were created by the formulas that you mention.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 10:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378630#M91047</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-24T10:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378631#M91048</link>
      <description>&lt;P&gt;The intnx function (read the documentation here: &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p10v3sa3i4kfxfn1sovhi5xzxh8n.htm&lt;/A&gt;) allows a fourth parameter that controls the positioning of the result within the target month: beginning, middle, end, same. This might influence your comparisons&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if the yymm variables are still constructed in the extremely unusable way you mentioned, they can't be used directly with date-related functions.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;STORE DATE VALUES AS SAS DATE VALUES!!!&lt;/STRONG&gt;&lt;/U&gt;, and not in some human-readable, but otherwise utterly useless form.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 10:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378631#M91048</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-24T10:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378634#M91049</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132979"&gt;@lixuan&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;the veariables a.yymm and b.yymm had been &amp;nbsp;both producted by 'yymm=100*year()+month()'&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;The formula you've posted is certainly not complete and would throw a syntax error. Is it eventually&amp;nbsp;something like:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;yymm=100*year(today()) + month(today());&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so then the values in variable&amp;nbsp;&lt;EM&gt;yymm&lt;/EM&gt;&amp;nbsp;are NOT SAS Date values. SAS calendar functions like intnx() require SAS Date/DateTime values. Read carefully what's in below link as you need to understand this concept.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a variable populated with the first of the current month then the formula would need to look like:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;yymm=intnx('month',date(),0,'b');&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 10:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378634#M91049</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-07-24T10:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378652#M91051</link>
      <description>&lt;P&gt;OK, here is my code. As you can see , before merge I format &amp;nbsp;both variables to date format which is in best12. fomat originally. But I get the result as following. the result with red line is obviously wrong.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data m_fegg;
set ibes.m_fegg;
cusip=substr(cusip,1,6);
format yymm yymmn6.;
run;
data sdc_final;
set sdc.sdc_final;
format yymm_a yymm_e yymmn6.;
run;
/*create the date before m&amp;amp;a*/
proc sql;
create table m_i_s1 as select b.*,a.yymm_a
from sdc_final as a, 
	 m_fegg as b
where intnx('month',a.yymm_a,-36)&amp;lt;=b.yymm&amp;lt;=a.yymm_a
	 &amp;amp; a.acq_cusip=b.cusip;
quit;
data m_i_s1;
set m_i_s1;
format yymm_a yymm best12.;&lt;BR /&gt;run;
&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10485iC9A1B0E986449A98/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="result" title="result" /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378652#M91051</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T12:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378653#M91052</link>
      <description>&lt;P&gt;Where is my result? I posted a picture.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378653#M91052</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T12:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378655#M91053</link>
      <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10486i768452908C767DD6/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="result" title="result" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378655#M91053</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T12:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378658#M91054</link>
      <description>&lt;P&gt;This&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sdc_final;
set sdc.sdc_final;
format yymm_a yymm_e yymmn6.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;just assigns another format. It does NOT change the values, and is therefore useless when you want to use your variables with date functions.&lt;/P&gt;
&lt;P&gt;Convert to real SAS date values, as I have already shown you in another thread of yours.&lt;/P&gt;
&lt;P&gt;Until you do that, all discussion regarding use of date functions is a waste of time.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378658#M91054</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-24T12:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378659#M91055</link>
      <description>&lt;P&gt;Just to illustrate your mistakes concerning data values and their formats:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydates;
input yymm;
cards;
199812
200403
;
run;

data play_around;
set mydates;
date_wrong = put(yymm,yymmn6.);
date_correct = input(put(yymm,6.) !! '01',yymmdd8.);
format date_correct date9.;
period = put(date_correct,yymmn6.);
date_correct_raw = date_correct;
format date_correct_raw best6.;
surprise = intnx('month',yymm,-36);
format surprise date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Start reading up on the internals of SAS date and time values:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings15/1334-2015.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings15/1334-2015.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378659#M91055</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-24T12:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378660#M91056</link>
      <description>&lt;P&gt;Looks like your YY.... variables do not contain dates, just integers.&lt;/P&gt;
&lt;P&gt;The difference between the numbers 200,403 and 199,812 is only 519.&lt;/P&gt;
&lt;P&gt;Which is less than the number of days in 36 months.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378660#M91056</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-24T12:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378664#M91058</link>
      <description>&lt;P&gt;PLS let me study for a while. I have many question about your codes. If I have any question, It' will be very&amp;nbsp;grateful that you can teach me .&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378664#M91058</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T12:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378733#M91083</link>
      <description>&lt;P&gt;Hi, &amp;nbsp; why can't I just input(yymm, yymmdd8.)? &amp;nbsp;and what the meaning of !! and '01' in input function? Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 15:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378733#M91083</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T15:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378740#M91084</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132979"&gt;@lixuan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi, &amp;nbsp; why can't I just input(yymm, yymmdd8.)? &amp;nbsp;and what the meaning of !! and '01' in input function? Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Let's look at the syntax you proposed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input(yymm, yymmdd8.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the INPUT() function is expecting a character string in the first argument. But isn't your variable a number (really an integer)? If so then in a data step SAS would silently convert that number to a string using the BEST12 format. So a value like 199,812 would become ' &amp;nbsp; &amp;nbsp; &amp;nbsp;199812'. &amp;nbsp;You then tell the INPUT() function to read then first 8 characters as if it was a date in YMD order. &amp;nbsp;So that would try to read six spaces followed by '19'. &amp;nbsp;That is not really a valid character representation of any valid date. And if you were using it in SQL statement then SAS would complain that YYMM variable was not a character string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On top of that even if YYMM was a character string and had a value like '198812' in it if you tried to read that using the YYMMDD8. informat it would fail. &amp;nbsp;The informat can handle strings with only 6 digits, but then it just assumes that you are using two digit years. In which case '88' is not a valid month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you want to use the YYMMDD informat you really need to supply values for the YY the MM and the DD. &amp;nbsp;So that is why the concatenation operator, || (which can also be represented by !! to support character sets and keyboards that do include the | character), and the extra '01' is used to supply the day of the month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you could also just use the YYMM informat instead, but that informat is new (less than 20 years old &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ) so many users don't think to use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 16:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378740#M91084</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-24T16:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378745#M91086</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Hi tom, you explain it very clearly. But I am puzzled with ||. just because of&amp;nbsp;put(yymm,6.), did you ad！！? If I want ouput yymm, can I change the code like this? But it didn't work. Sorry ,because I am a new user. Also, where can I find the date format like yymmn6 etc.? Thank you&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date_correct = input(put(yymm,6.) '01',yymm6.);
format date_correct date6.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jul 2017 16:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378745#M91086</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-24T16:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: should the date in the intnx functiointn  be in date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378749#M91087</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132979"&gt;@lixuan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Hi tom, you explain it very clearly. But I am puzzled with ||. just because of&amp;nbsp;put(yymm,6.), did you ad！！? If I want ouput yymm, can I change the code like this? But it didn't work. Sorry ,because I am a new user. Also, where can I find the date format like yymmn6 etc.? Thank you&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date_correct = input(put(yymm,6.) '01',yymm6.);
format date_correct date6.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Didn't you get any error message from SAS when you tried that?&lt;/P&gt;
&lt;P&gt;What did they tell you? &amp;nbsp;You really need to learn how to read the error messages since it will help you correct your mistakes and typos.&lt;/P&gt;
&lt;P&gt;Let's run it and see.&lt;/P&gt;
&lt;PRE&gt;151  data _null_;
152   yymm=198812;
153  date_correct = input(put(yymm,6.) '01',yymm6.);
                                       ---- ------
                                       22   48
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =,
              &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, LE, LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=.

ERROR 48-59: The informat YYMM was not found or could not be loaded.

154  format date_correct date6.;
155  run;
&lt;/PRE&gt;
&lt;P&gt;So the first error message shows that you didn't include the concatenation operator between the two strings. It is listing all of the possible operators that you might want to place between two value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second error shows that YYMM is NOT a valid informat. &amp;nbsp;Look at the list of possible informats. &amp;nbsp;A quick google search like this should find a number of SAS man pages. &lt;A title="https://www.google.com/search?q=%40sas.com+date+informat" href="https://www.google.com/search?q=%40sas.com+date+informat" target="_self"&gt;https://www.google.com/search?q=%40sas.com+date+informat&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if we look at the page for SAS 9.4 formats by category we see these two informats.&lt;/P&gt;
&lt;PRE&gt;YYMMDDw. Informat	Reads date values in the form yymmdd or yyyymmdd.
YYMMNw. Informat	Reads date values in the form yyyymm or yymm.&lt;/PRE&gt;
&lt;P&gt;So it looks we need to add the letter N after YYMM to get the right informat name.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 17:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/should-the-date-in-the-intnx-function-be-in-date-format/m-p/378749#M91087</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-24T17:14:03Z</dc:date>
    </item>
  </channel>
</rss>

