<?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: Keep date as text when exporting sas dataset to CSV in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580033#M13508</link>
    <description>&lt;P&gt;Yes, below is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;export&lt;/STRONG&gt; data=export&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile="&amp;amp;PROJROOT.\Analysis\&amp;amp;csvFileName"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=csv replace;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok, then how can I save as CSV file not from excel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Adithya&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 23:28:17 GMT</pubDate>
    <dc:creator>chinna0369</dc:creator>
    <dc:date>2019-08-08T23:28:17Z</dc:date>
    <item>
      <title>Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580017#M13505</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying export one of my sas data set into CSV file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the data set:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture 1.PNG" style="width: 88px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31600i7AEBB19EF857ECBC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture 1.PNG" alt="Capture 1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;when I open that CSV file in excel then I am getting the above highlighted value as "5-JAN".&lt;/P&gt;&lt;P&gt;How can keep that value as it is when exporting?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Adithya&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 22:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580017#M13505</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2019-08-08T22:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580030#M13507</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/117414"&gt;@chinna0369&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying export one of my sas data set into CSV file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;below is the data set:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture 1.PNG" style="width: 88px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31600i7AEBB19EF857ECBC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture 1.PNG" alt="Capture 1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;when I open that CSV file in excel then I am getting the above highlighted value as "5-JAN".&lt;/P&gt;
&lt;P&gt;How can keep that value as it is when exporting?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Adithya&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;My first instruction would be to &lt;STRONG&gt;not&lt;/STRONG&gt; open CSV files in Excel, second would be not to save them from Excel. This is an Excel behavior. Excel will interpret cells to be of certain types based on content. In this case, it has decided the value is a date and one of the Excel preferred displays for such things is the day-Month. If you go the one of those cells and change cell property you will likely see the actual value is 5 Jan 2019.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you show us how you exported your dataset we might be able to provide some hints if you are going to insist on opening them with Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you open the CSV in a text viewer such as Notepad, Wordpad or similar programs you will likely see the expected values.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 23:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580030#M13507</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-08T23:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580033#M13508</link>
      <description>&lt;P&gt;Yes, below is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;export&lt;/STRONG&gt; data=export&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile="&amp;amp;PROJROOT.\Analysis\&amp;amp;csvFileName"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=csv replace;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok, then how can I save as CSV file not from excel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Adithya&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 23:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580033#M13508</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2019-08-08T23:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580050#M13511</link>
      <description>&lt;P&gt;This is not a SAS issue, it's an Excel issue. If you open the CSV with a text editor such as Notepad or NotePad++ you'll see the correct values. Excel is changing the values when it opens the file, by default. DO NOT OPEN CSV's with Excel.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/117414"&gt;@chinna0369&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, below is the code I am using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;export&lt;/STRONG&gt; data=export&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile="&amp;amp;PROJROOT.\Analysis\&amp;amp;csvFileName"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=csv replace;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ok, then how can I save as CSV file not from excel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Adithya&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 02:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580050#M13511</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-09T02:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580106#M13516</link>
      <description>If you have to use Excel open CSV, then add single quote before TRT. Like :  trt=cats("'",trt);    . and PROC IMPORT the table .</description>
      <pubDate>Fri, 09 Aug 2019 11:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580106#M13516</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-08-09T11:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580166#M13521</link>
      <description>&lt;P&gt;Do not let your computer automatically use Excel to open the CSV file.&amp;nbsp; Instead open Excel and then use the menu item that lets' you bring in a CSV file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an excellent article from 12 years ago (updated 7 years ago) that explains what Excel is doing wrong.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://practicalsurveys.com/technology/excelcsv.php" target="_blank"&gt;https://practicalsurveys.com/technology/excelcsv.php&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excel seems to making this harder and harder with each version of Excel.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions for Office 365 are here:&amp;nbsp;&amp;nbsp;&lt;A href="https://support.office.com/en-us/article/text-import-wizard-c5b02af6-fda1-4440-899f-f78bafe41857" target="_blank" rel="noopener"&gt;https://support.office.com/en-us/article/text-import-wizard-c5b02af6-fda1-4440-899f-f78bafe41857&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;So you need to ENABLE the wizard that used to be the defaule.&lt;/P&gt;
&lt;P&gt;The from the DATA menu select Get Data. Then find the legacy text import wizard.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 474px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31627iCDD4AB54C784B5E2/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 15:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580166#M13521</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-09T15:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580191#M13525</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/117414"&gt;@chinna0369&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, below is the code I am using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;export&lt;/STRONG&gt; data=export&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile="&amp;amp;PROJROOT.\Analysis\&amp;amp;csvFileName"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=csv replace;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ok, then how can I save as CSV file not from excel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Adithya&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I have different programs associated with CSV so I can open with the desired program. In Windows from the file explorer right click to bring up the file menu, select Open With. If nothing except Excel is associated then you can click on "Choose another app" to bring up a menu box where you can select another program such as Notepad, Wordpad or such. You can even change the default opening behavior at that time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After you have done this the next time you want to open a CSV file, use the right click, Open With and select which program you want at this time to open the file.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 16:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580191#M13525</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-09T16:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Keep date as text when exporting sas dataset to CSV</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580220#M13530</link>
      <description>&lt;P&gt;I played around with the new From Text/CSV tool in Excel (under the Data) Menu and it seems to work a little better than the older text import method.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 549px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31626i85711921D5E0F455/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There is a way to EDIT the data types that it has assigned to the columns after you use it to open the CSV file.&amp;nbsp; From the Edit screen you can click on the TRANSFORM tab and then select columns and change the data type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I took a dump of part of SASHELP.CLASS and edited a few cells to introduce some issues.&amp;nbsp; I put some things that Excel thinks look like dates in the NAME column and the as the header for the WEIGHT column.&lt;/P&gt;
&lt;PRE&gt;Name,Sex,Age,Height,SEP05
Alfred,M,014,69,112.5
DEC05,F,013,56.5,84
Barbara,F,13,65.3,98
10-19,F,14,62.8,102.5
Henry,M,14,63.5,102.5&lt;/PRE&gt;
&lt;P&gt;I then tried opening it with Excel in three ways.&amp;nbsp; Once just using File Open.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 442px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31635i62AE05E42FCB38FE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then using the legacy text import tool. Where I manually told it that the data had headers, that comma as the delimiter and that it should treat the first three columns as TEXT instead of GENERAL.&amp;nbsp; That worked except for the header for column E.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 414px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31639i134ED877824D060B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then I used the new From Text/CSV tool, without any changes and it didn't recognize that the file had header row. So it treated all of the columns as text, instead of treating the last two as numbers.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 523px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31640i49DB6133973127BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But if I used the EDIT button and the TRANSFORM tab I was able to tell it that it should use first row as headers.&amp;nbsp; That fixed the last two column types, but I had to manually tell it to treat the third column as text.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 388px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31641iDCA88B40B8A0208F/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 18:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Keep-date-as-text-when-exporting-sas-dataset-to-CSV/m-p/580220#M13530</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-09T18:02:44Z</dc:date>
    </item>
  </channel>
</rss>

