<?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: SAS Date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567397#M159552</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;
libname XL xlsx  "~/dat/Book1.xlsx";
data x;
set xl.sheet1;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30414iC9FEE1AC7A47404C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2019 19:25:47 GMT</pubDate>
    <dc:creator>ghosh</dc:creator>
    <dc:date>2019-06-19T19:25:47Z</dc:date>
    <item>
      <title>SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567225#M159485</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've excel file shown below as input ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Report Name&amp;nbsp; Address&amp;nbsp; June14,2019&amp;nbsp; June 15,2019&lt;/P&gt;&lt;P&gt;Daily&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CH&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CJ&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MJ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After i used below syntax to import&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import out=ds_new datafile="/Sasdata/SAS_Reports_Tracker_2019.xlsx"&lt;BR /&gt;dbms=xlsx replace;&lt;BR /&gt;sheet="SAS_Reports_June19";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not getting same output as input , I'm getting as&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Report Name&amp;nbsp; Address&amp;nbsp; &amp;nbsp; &amp;nbsp;43586&amp;nbsp; &amp;nbsp; &amp;nbsp;43587&lt;/P&gt;&lt;P&gt;Daily&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CH&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CJ&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MJ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both Dates (June14,2019&amp;nbsp; June 15,2019) has converted to SAS internal Date format, However i need exact same output as input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 12:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567225#M159485</guid>
      <dc:creator>jaiganesh</dc:creator>
      <dc:date>2019-06-19T12:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567226#M159486</link>
      <description>&lt;P&gt;A SAS variable name con not contain a comma. Try deleting that.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 12:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567226#M159486</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-19T12:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567228#M159488</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240933"&gt;@jaiganesh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add to Proc Import :&amp;nbsp;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=YES;&lt;/FONT&gt; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 12:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567228#M159488</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-06-19T12:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567237#M159492</link>
      <description>&lt;P&gt;If you want control over the import process, DO NOT use proc import. Save the data to a text file from Excel, and read that with a data step where&amp;nbsp;&lt;EM&gt;you&lt;/EM&gt; set variable names and attributes.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 12:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567237#M159492</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-19T12:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567273#M159506</link>
      <description>&lt;P&gt;I've used the same However same output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 13:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567273#M159506</guid>
      <dc:creator>jaiganesh</dc:creator>
      <dc:date>2019-06-19T13:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567300#M159518</link>
      <description>&lt;P&gt;A SAS dataset is not a spreadsheet.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In particular you cannot use numbers as your variable names.&amp;nbsp; So SAS is converting the internal value of the cells (the number of days since 1900 with mistaken inclusion of 29FEB1900) as the character representation of that number.&amp;nbsp; It will do the same thing to date values that you insert into cells in character variables so trying the read the values without columns headers will not help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To convert the numbers back into dates first convert them from strings into numbers and then subtract the number days between the two different base dates.&amp;nbsp; Since 1900 is a negative number of days relative to 1960 you just need to do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sasdate=input(excel_date_string,32.)+'30DEC1899'd;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then attach your date format of choice to have the numbers appear as dates when printed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 14:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567300#M159518</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-19T14:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567302#M159519</link>
      <description>&lt;P&gt;Let me tell you the case very briefly, I have below columns&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Name 43587&amp;nbsp; &amp;nbsp;43591&amp;nbsp; 43592&lt;BR /&gt;Jai&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Done&amp;nbsp; &amp;nbsp; Done&amp;nbsp; &amp;nbsp; Done;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now above columns&amp;nbsp;43587&amp;nbsp; &amp;nbsp;43591&amp;nbsp; 43592&amp;nbsp; need to be rename with 01/05/2019 02/05/2019 06/05/2019 respectively...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly suggest....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 14:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567302#M159519</guid>
      <dc:creator>jaiganesh</dc:creator>
      <dc:date>2019-06-19T14:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567319#M159530</link>
      <description>Please show a screen shot of your data set after import and the code you've used. I'd recommend a transpose anyways to store your data.</description>
      <pubDate>Wed, 19 Jun 2019 15:25:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567319#M159530</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-19T15:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567344#M159536</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached the Screen shot of my data, Please have a look and suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find below code i used for it,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import out=SAS/SAS_Reports_2019.xlsx"&lt;BR /&gt;dbms=xlsx replace;&lt;BR /&gt;sheet="SAS_Reports_June19";&lt;BR /&gt;getnames=Yes;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 16:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567344#M159536</guid>
      <dc:creator>jaiganesh</dc:creator>
      <dc:date>2019-06-19T16:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567365#M159540</link>
      <description>If you switch to labels, I suspect you'll see your dates. Anyways, to solve your problem, the easiest solution is to:&lt;BR /&gt;&lt;BR /&gt;1. Transpose your data to a long format&lt;BR /&gt;2. Convert Dates to sAS dates&lt;BR /&gt;3. Create a variable with the names you want&lt;BR /&gt;4. Do another proc transpose. &lt;BR /&gt;&lt;BR /&gt;Another option is to manually rename the columns. &lt;BR /&gt;&lt;BR /&gt;Rename '493433'n = D2019_06_19;&lt;BR /&gt;&lt;BR /&gt;Try setting:&lt;BR /&gt;&lt;BR /&gt;options validvarname=v7;&lt;BR /&gt; &lt;BR /&gt;Reimport the data after that option and that may help with the names a bit, but not sure.</description>
      <pubDate>Wed, 19 Jun 2019 17:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567365#M159540</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-19T17:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567397#M159552</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;
libname XL xlsx  "~/dat/Book1.xlsx";
data x;
set xl.sheet1;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30414iC9FEE1AC7A47404C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 19:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-format/m-p/567397#M159552</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2019-06-19T19:25:47Z</dc:date>
    </item>
  </channel>
</rss>

