<?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: Reading Date Format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515869#M139264</link>
    <description>&lt;P&gt;Okay, let's eliminate obvious potential problems here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;After you changed the code, did you actually execute the code with the changes?&lt;/LI&gt;
&lt;LI&gt;Are there errors or warnings in the log?&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Mon, 26 Nov 2018 02:15:40 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-11-26T02:15:40Z</dc:date>
    <item>
      <title>Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515861#M139257</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to SAS and I was wondering how I could change the YearMon date into another format.&lt;/P&gt;&lt;P&gt;I did it successfully by using the comment on line 4 by removing the "M", but I do not know how to do it without that code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe there is an informat that I am missing, as I have already tried anydtdte32 and yymm.&lt;/P&gt;&lt;P&gt;I am trying to do it in simple way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/25154iC2F1FE0A1C29B01B/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS.png" alt="SAS.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 01:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515861#M139257</guid>
      <dc:creator>PS1214</dc:creator>
      <dc:date>2018-11-26T01:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515862#M139258</link>
      <description>&lt;P&gt;You don't say what result you want, what format you would like to see your dates displayed as.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, looking at your code, I think all you have to do is change the format statement to something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format newdate date9.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can choose any valid SAS date format to obtain the result you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The 2017M09 comes directly from the format statement that you are using, yymm10. — and any other valid format statement will change the appearance of the date, but will not change the underlying numeric SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, please copy and paste your SAS code into the window that appears when you click on the running man icon.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 01:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515862#M139258</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-26T01:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515863#M139259</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for responding. I am trying to figure out any valid date format, it doesn't matter. I was experimenting on how to change the variable YearMon to another date format, but I wasn't having any luck in doing it.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datechange;
	set pg1.eu_occ;
/* 	YearMon=tranwrd(YearMon, "M", "-"); */
	Newdate=input(YearMon, anydtdte32.);
	format Newdate yymm10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515863#M139259</guid>
      <dc:creator>PS1214</dc:creator>
      <dc:date>2018-11-26T02:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515864#M139260</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247193"&gt;@PS1214&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for responding. I am trying to figure out any date format, it doesn't matter. I was experimenting on how to change the variable YearMon to another date format, but I wasn't having any luck in doing it.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I explained how to change the format in my earlier reply.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515864#M139260</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-26T02:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515865#M139261</link>
      <description>&lt;P&gt;Are you talking about line 6? If so, it does not return back any value.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515865#M139261</guid>
      <dc:creator>PS1214</dc:creator>
      <dc:date>2018-11-26T02:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515866#M139262</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247193"&gt;@PS1214&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Are you talking about line 6? If so, it does not return back any value.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm afraid this contains no helpful information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us the code you used. Show us the result.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515866#M139262</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-26T02:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515868#M139263</link>
      <description>&lt;P&gt;I am not sure what more you want.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datechange;
	set pg1.eu_occ;
/* 	YearMon=tranwrd(YearMon, "M", "-"); */
	Newdate=input(YearMon, anydtdte32.);
	format Newdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I used that, and the output is the same as in the picture in post one.&lt;/P&gt;&lt;P&gt;I replaced "date9" with many other formats and it does not work.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:12:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515868#M139263</guid>
      <dc:creator>PS1214</dc:creator>
      <dc:date>2018-11-26T02:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515869#M139264</link>
      <description>&lt;P&gt;Okay, let's eliminate obvious potential problems here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;After you changed the code, did you actually execute the code with the changes?&lt;/LI&gt;
&lt;LI&gt;Are there errors or warnings in the log?&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:15:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515869#M139264</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-26T02:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515872#M139265</link>
      <description>&lt;P&gt;This is what the log shows&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/25156i3220A7D0D05498A4/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas2.png" alt="sas2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I can say it this way.&lt;/P&gt;&lt;P&gt;This doesn't work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datechange;
	set pg1.eu_occ;
	Newdate=input("2018M03",anydtdte32.);
	format NewDate yymm10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this works&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datechange;
	set pg1.eu_occ;
	Newdate=input("2018-03",anydtdte32.);
	format NewDate yymm10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515872#M139265</guid>
      <dc:creator>PS1214</dc:creator>
      <dc:date>2018-11-26T02:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515873#M139266</link>
      <description>&lt;P&gt;Okay, so obviously your variable YEARMON is not a valid SAS date, it most likely is a character string. This is an important distinction. In order to change this to a valid SAS date, you must use an informat that matches the format of the character string, and I am not aware of such an informat. (There is the YYMMN. informat but that does not allow the letter M in the date).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, you will have to parse the value of character variable yearmon into numeric year and numeric month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datechange;
    set pg1.eu_occ;
    newdate = mdy(input(substr(yearmon,1,4),4.),1,input(substr(yearmon,6,2),2.);
    format newdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515873#M139266</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-26T02:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515875#M139267</link>
      <description>Ok thank you for your patience and help.&lt;BR /&gt;&lt;BR /&gt;I was hoping there was a way.</description>
      <pubDate>Mon, 26 Nov 2018 02:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515875#M139267</guid>
      <dc:creator>PS1214</dc:creator>
      <dc:date>2018-11-26T02:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515879#M139268</link>
      <description>The code you posted does not seem to work.</description>
      <pubDate>Mon, 26 Nov 2018 02:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Format/m-p/515879#M139268</guid>
      <dc:creator>PS1214</dc:creator>
      <dc:date>2018-11-26T02:42:34Z</dc:date>
    </item>
  </channel>
</rss>

