<?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: Change Date formatt in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626664#M20418</link>
    <description>&lt;P&gt;But you still haven't told me what the conversion is. You have not explained that. I want you to tell me what the logic is, even if you have to do it pencil and paper, explain how 40753 converts to some other appearance, in your last message you said you want to it to convert to 40694. You tell me the logic that takes 40753 and turns it into 40694, and then I can tell you what the code is.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I have a dataset which when loaded in SAS is giving dates in numeric numbers.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, originally you said the date value was character and now you are saying it is numeric??&lt;/P&gt;</description>
    <pubDate>Sat, 22 Feb 2020 20:08:40 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-02-22T20:08:40Z</dc:date>
    <item>
      <title>Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626656#M20411</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a data set which has a column or variable of date in numeric eg 40753 (attribute is $10.). I want to change the format of the column to show me dates in MMYYYY formatt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me the program to write in proc Sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Vipin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2020 19:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626656#M20411</guid>
      <dc:creator>VipinA</dc:creator>
      <dc:date>2020-02-22T19:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626657#M20412</link>
      <description>&lt;P&gt;What date should 40753 appear as?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2020 19:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626657#M20412</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-22T19:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626658#M20413</link>
      <description>&lt;P&gt;052011&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2020 19:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626658#M20413</guid>
      <dc:creator>VipinA</dc:creator>
      <dc:date>2020-02-22T19:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626660#M20414</link>
      <description>&lt;P&gt;I'm sorry, I don't see how 40753 translates to 052011. Can you explain?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2020 19:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626660#M20414</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-22T19:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626661#M20415</link>
      <description>It’s 40694&lt;BR /&gt;</description>
      <pubDate>Sat, 22 Feb 2020 19:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626661#M20415</guid>
      <dc:creator>VipinA</dc:creator>
      <dc:date>2020-02-22T19:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626662#M20416</link>
      <description>&lt;P&gt;I still don't understand, could you please explain??&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2020 19:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626662#M20416</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-22T19:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626663#M20417</link>
      <description>I have a dataset which when loaded in SAS is giving dates in numeric numbers. Want to convert the same back to date format in SAS data set so that I can summarise records of a particular month.&lt;BR /&gt;&lt;BR /&gt;I am currently unable to convert the numbers back to date formatt.&lt;BR /&gt;</description>
      <pubDate>Sat, 22 Feb 2020 20:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626663#M20417</guid>
      <dc:creator>VipinA</dc:creator>
      <dc:date>2020-02-22T20:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626664#M20418</link>
      <description>&lt;P&gt;But you still haven't told me what the conversion is. You have not explained that. I want you to tell me what the logic is, even if you have to do it pencil and paper, explain how 40753 converts to some other appearance, in your last message you said you want to it to convert to 40694. You tell me the logic that takes 40753 and turns it into 40694, and then I can tell you what the code is.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I have a dataset which when loaded in SAS is giving dates in numeric numbers.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, originally you said the date value was character and now you are saying it is numeric??&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2020 20:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626664#M20418</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-22T20:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626665#M20419</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;The number is 40694, date will be 31/5/2011&lt;BR /&gt;</description>
      <pubDate>Sat, 22 Feb 2020 20:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626665#M20419</guid>
      <dc:creator>VipinA</dc:creator>
      <dc:date>2020-02-22T20:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626670#M20420</link>
      <description>&lt;P&gt;So you claim that 40,753 represents that last day in MAY of the year 2011.&lt;/P&gt;
&lt;P&gt;Assuming that it represents the number of days since some date it is not hard to figure out what value you need add/subtract from it to get an actual date value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;2960  data x;
2961   have=40753 ;
2962   want='31MAY2011'd ;
2963   diff=want-have;
2964   put (_all_) (=comma12.);
2965  run;

have=40,753 want=18,778 diff=-21,975
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Feb 2020 21:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626670#M20420</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-22T21:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626690#M20422</link>
      <description>&lt;P&gt;Perhaps it's Excel date? Days since 1/1/1900 -- 5/31/2011 is around 40694 I imagine.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Feb 2020 04:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626690#M20422</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2020-02-23T04:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626694#M20423</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270457"&gt;@unison&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Perhaps it's Excel date? Days since 1/1/1900 -- 5/31/2011 is around 40694 I imagine.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is a couple of months off from being Excel dates.&amp;nbsp; Unless the original poster is wrong about what date the number represents. To fix Excel dates add '30DEC1899'D (dates before 1960 are negative numbers).&amp;nbsp; Excel using 1900 as the based date instead of 1960 that SAS uses.&amp;nbsp; But they disagree on whether to count from zero or one and Excel mistakenly thinks that 1900 was a leap year.&lt;/P&gt;
&lt;PRE&gt;2966  data x;
2967   have=40753 ;
2968   want='31MAY2011'd ;
2969   diff=want-have;
2970   put (_all_) (=comma12.);
2971   put (_all_) (=date9.);
2972
2973  run;

have=40,753 want=18,778 diff=-21,975
have=30JUL2071 want=31MAY2011 diff=01NOV1899
&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 Feb 2020 05:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626694#M20423</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-23T05:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change Date formatt</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626695#M20424</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/313370"&gt;@VipinA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi&lt;BR /&gt;&lt;BR /&gt;The number is 40694, date will be 31/5/2011&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Best would be if you change your import step so that the Excel date gets converted into a SAS date value (stored in a numerical variable).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...but to give you exactly what you're asking for.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length var $10.;
  var='40694';
run; 

data _null_;
  shiftval='01Jan1960'd -'01Jan1900'd+2;
  call symputx('shiftval', shiftval);
  stop;
run;

proc sql;
  select
    put(input(var,? best32.)-&amp;amp;shiftval,mmyyn6.) as var 
  from have
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 Feb 2020 05:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Date-formatt/m-p/626695#M20424</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-02-23T05:18:25Z</dc:date>
    </item>
  </channel>
</rss>

