<?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 change date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693915#M211603</link>
    <description>&lt;P&gt;So someone tried to be cute and fumbled the ball.&lt;/P&gt;
&lt;P&gt;Do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date = input(put(date,z6.)!!'01',yymmdd8.);
format date yymmn6.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;immediately after the import.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Oct 2020 20:06:05 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-10-23T20:06:05Z</dc:date>
    <item>
      <title>how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693896#M211594</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I import sas file usinh this line&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc import datafile = 'C:\MaRecherche\IPO\data_full_sample\FF_factors.xlsx' DBMS = Excel OUT = Factors ; sheet="F-F_Research_Data_Factors";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I get the data the variable date has a format best12. et informat 12. I want to change the format to&amp;nbsp;YYMMDDN8. and informat 8.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do it in this way&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data JOINT;&lt;BR /&gt;set JOINT;&lt;BR /&gt;format date yymmddn8.;&lt;BR /&gt;informat date 8.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it does not work. it gives strange dates!!!!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 19:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693896#M211594</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2020-10-23T19:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693899#M211595</link>
      <description>&lt;P&gt;Changing an informat has no effect. The informat is only used when a variable is read from an external file with an INPUT statement.&lt;/P&gt;
&lt;P&gt;Which values do you see without a format?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 19:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693899#M211595</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-23T19:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693900#M211596</link>
      <description>&lt;P&gt;i see this&amp;nbsp;06AUG2487 for the date 192701!!!!!!!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 19:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693900#M211596</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2020-10-23T19:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693904#M211597</link>
      <description>&lt;P&gt;A raw value of 192701 is, as you see, very far in the future, both in SAS and Excel.&lt;/P&gt;
&lt;P&gt;(in Excel it would be in 2427)&lt;/P&gt;
&lt;P&gt;What do you see in that cell when you open the spreadsheet in Excel?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 19:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693904#M211597</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-23T19:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693905#M211598</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;i see this&amp;nbsp;06AUG2487 for the date 192701!!!!!!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And what date should 192701 be?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS stores dates and the number of days from 1Jan1960. Which is why applying a date format to a random number, which a BEST informat indicates the value was read a simple number, generates values that appear to be "incorrect".&lt;/P&gt;
&lt;P&gt;You will likely need to do some manipulation of your existing values to get to a numeric value that represents the appropriate date in SAS terms. To do that we need to know what values you actually have and what dates they should be, at least for a few samples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One suspects the spreadsheet did not contain a date either. Instead someone was entering just a Year and Month number, not an actual date in any term (need a day of month to be an actual date).&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 19:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693905#M211598</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-23T19:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693912#M211601</link>
      <description>&lt;P&gt;192701 is 1927jan (year/month)&lt;/P&gt;
&lt;P&gt;when I open excel I see 192701 and is a standard format in excel&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 19:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693912#M211601</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2020-10-23T19:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693915#M211603</link>
      <description>&lt;P&gt;So someone tried to be cute and fumbled the ball.&lt;/P&gt;
&lt;P&gt;Do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date = input(put(date,z6.)!!'01',yymmdd8.);
format date yymmn6.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;immediately after the import.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 20:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693915#M211603</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-23T20:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to change date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693988#M211623</link>
      <description>&lt;P&gt;Or, even shorter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date = input(put(date,z6.),yymmn6.);
format date yymmn6.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Oct 2020 11:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-change-date-format/m-p/693988#M211623</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-24T11:06:28Z</dc:date>
    </item>
  </channel>
</rss>

