<?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: problem export to csv file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575934#M162968</link>
    <description>&lt;P&gt;Please show the actual CSV file (not those tables you show in your post). Perhaps your issue is the tool you are using to LOOK at the CSV file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A CSV file is a text file. Should look like:&lt;/P&gt;
&lt;PRE&gt;NO.,ID,visit,VALUE1,VALUE2,VALUE3,VALUE4,VALUE5,VALUE6
1,100,1,A,B,C,D,E,F
2,200,1,A,B,C,D,E,F
3,,,B,C,D,E,F 
4,,,B,C,D,E,F&lt;/PRE&gt;
&lt;P&gt;What code did you run to produce the CSV file?&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2019 19:00:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-07-23T19:00:16Z</dc:date>
    <item>
      <title>problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575921#M162961</link>
      <description>&lt;P&gt;HI there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I export file to csv format, the output file looks error.&lt;/P&gt;
&lt;P&gt;some rows files are missing values for some variables, see below example for detail:&lt;/P&gt;
&lt;TABLE width="576"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;NO.&lt;/TD&gt;
&lt;TD width="64"&gt;ID&lt;/TD&gt;
&lt;TD width="64"&gt;visit&lt;/TD&gt;
&lt;TD width="64"&gt;VALUE1&lt;/TD&gt;
&lt;TD width="64"&gt;VALUE2&lt;/TD&gt;
&lt;TD width="64"&gt;VALUE3&lt;/TD&gt;
&lt;TD width="64"&gt;VALUE4&lt;/TD&gt;
&lt;TD width="64"&gt;VALUE5&lt;/TD&gt;
&lt;TD width="64"&gt;VALUE6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;D&lt;/TD&gt;
&lt;TD&gt;E&lt;/TD&gt;
&lt;TD&gt;F&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;D&lt;/TD&gt;
&lt;TD&gt;E&lt;/TD&gt;
&lt;TD&gt;F&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;D&lt;/TD&gt;
&lt;TD&gt;E&lt;/TD&gt;
&lt;TD&gt;F&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;D&lt;/TD&gt;
&lt;TD&gt;E&lt;/TD&gt;
&lt;TD&gt;F&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;row 1 and 2 are correct, but row 3 and 4 are wrong.&lt;/P&gt;
&lt;P&gt;row 3 and 4 are missing values for variables ID, visit, and value1. so the VALUE2(=B) was filled in ID field, VALUE3(=C) was filled in visit field and so on..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the correct one will be like this:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 432pt;" border="0" width="576" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl65" style="height: 15.0pt; width: 48pt;"&gt;NO.&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;visit&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;VALUE1&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;VALUE2&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;VALUE3&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;VALUE4&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;VALUE5&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;VALUE6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl65" style="height: 15.0pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;100&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;D&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;E&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;F&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl65" style="height: 15.0pt; border-top: none;"&gt;2&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;200&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;D&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;E&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;F&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl65" style="height: 15.0pt; border-top: none;"&gt;3&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;300&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;D&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;E&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;F&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl65" style="height: 15.0pt; border-top: none;"&gt;4&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;400&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;D&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;E&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;F&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;any one can help to solve the problem?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you very much in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 18:40:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575921#M162961</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2019-07-23T18:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575932#M162966</link>
      <description>&lt;P&gt;Inspect the file with a text editor (eg notepad++). If there's further doubt, copy/paste the contents into a window opened with the {i} button.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 18:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575932#M162966</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-23T18:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575934#M162968</link>
      <description>&lt;P&gt;Please show the actual CSV file (not those tables you show in your post). Perhaps your issue is the tool you are using to LOOK at the CSV file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A CSV file is a text file. Should look like:&lt;/P&gt;
&lt;PRE&gt;NO.,ID,visit,VALUE1,VALUE2,VALUE3,VALUE4,VALUE5,VALUE6
1,100,1,A,B,C,D,E,F
2,200,1,A,B,C,D,E,F
3,,,B,C,D,E,F 
4,,,B,C,D,E,F&lt;/PRE&gt;
&lt;P&gt;What code did you run to produce the CSV file?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 19:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575934#M162968</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-23T19:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575936#M162970</link>
      <description>&lt;P&gt;I'm using :&lt;/P&gt;
&lt;P&gt;proc export data= test&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dbms=csv&lt;/P&gt;
&lt;P&gt;file='test.csv';run;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 19:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575936#M162970</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2019-07-23T19:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575938#M162971</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34666"&gt;@ursula&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm using :&lt;/P&gt;
&lt;P&gt;proc export data= test&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dbms=csv&lt;/P&gt;
&lt;P&gt;file='test.csv';run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To QC the file add a step to dump the first few lines to the LOG for review.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'test.csv' obs=10;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 19:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575938#M162971</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-23T19:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575941#M162972</link>
      <description>&lt;P&gt;if I export to excel file, all are going well. The only issue is, the output excel file cannot hold the format that I run in the code.&lt;/P&gt;
&lt;P&gt;for example; 1 = yes, 2 = no.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the output excel file, it will show as 1, and 2, but I need it shows 'Yes' ans "No".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the reason I'm using output csv is, the output file will show "Yes" and "No", and then I convert it to excel file.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 19:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575941#M162972</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2019-07-23T19:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575949#M162973</link>
      <description>&lt;P&gt;If you are using a reasonable recent release of SAS then use the ODS EXCEL destination and PROC PRINT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='myfile.xlsx';
proc print data=test;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 19:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575949#M162973</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-23T19:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575953#M162975</link>
      <description>Use ODS EXCEL instead then if you want formatted otuput. I suspect some of your fields are text and have either a tab or line return that Excel is interpreting incorrectly and splitting lines instead of maintaining the correct output. &lt;BR /&gt;&lt;BR /&gt;ODS EXCEL file='myfile.xlsx';&lt;BR /&gt;proc print data=sashelp.class;&lt;BR /&gt;run;&lt;BR /&gt;ods excel close;&lt;BR /&gt;&lt;BR /&gt;There are lots of options to customize the output as desired. This assumes you're using SAS 9.4 TS1M3+</description>
      <pubDate>Tue, 23 Jul 2019 19:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575953#M162975</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-23T19:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575956#M162977</link>
      <description>&lt;P&gt;I have tried it, but the output did not hold the format. especially for date, it showed numbers instead of mm/dd/yy.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 19:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575956#M162977</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2019-07-23T19:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575963#M162981</link>
      <description>&lt;P&gt;Works fine for me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set sashelp.class;
  date = '01JAN2019'd + int(180*ranuni(0));
  format date mmddyy10.;
run;

ods excel file='c:\downloads\test_date.xlsx';
proc print data=test;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 536px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31246i7D7B8D2C65B60A2E/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;
&lt;P&gt;That is one of the advantages of writing an XLSX file instead of a CSV file. A CSV has no place to store the TYPE of a column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing to remember is NEVER let Excel open your CSV files on its own.&amp;nbsp; It will change data values.&amp;nbsp; Always open Excel&amp;nbsp; and use the menus to import the CSV file so that you get the chance to tell Excel what data type each column contains.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 19:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575963#M162981</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-23T19:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575988#M162989</link>
      <description>&lt;P&gt;Thank you all for the nice comment and useful information.&lt;/P&gt;
&lt;P&gt;I really appreciate for your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have figured it, by cleaning the raw file, every thing is going well!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 21:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/575988#M162989</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2019-07-23T21:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576183#M163059</link>
      <description>You removed the hard returns? Post what the solution was and mark that answer as correct please.</description>
      <pubDate>Wed, 24 Jul 2019 14:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576183#M163059</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-24T14:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576689#M163271</link>
      <description>&lt;P&gt;after look into the original file, I realized that there is one "text: field have "space" in the value, for example:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this original file: (this is not a real data, the actual data have more variables including date field).&lt;/P&gt;
&lt;TABLE style="height: 77px; width: 251px;" width="330"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 40px;"&gt;ID&lt;/TD&gt;
&lt;TD style="height: 19px; width: 40px;"&gt;visit&lt;/TD&gt;
&lt;TD style="height: 19px; width: 46px;"&gt;value1&amp;nbsp;&lt;/TD&gt;
&lt;TD style="height: 19px; width: 40px;"&gt;Name&lt;/TD&gt;
&lt;TD style="height: 19px; width: 42px;"&gt;value3&lt;/TD&gt;
&lt;TD style="height: 19px; width: 42px;"&gt;value4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 39px;"&gt;
&lt;TD style="height: 39px; width: 40px;"&gt;100&lt;/TD&gt;
&lt;TD style="height: 39px; width: 40px;"&gt;1&lt;/TD&gt;
&lt;TD style="height: 39px; width: 46px;"&gt;Asia&lt;/TD&gt;
&lt;TD style="height: 39px; width: 40px;"&gt;Lita wong&lt;/TD&gt;
&lt;TD style="height: 39px; width: 42px;"&gt;Honda&lt;/TD&gt;
&lt;TD style="height: 39px; width: 42px;"&gt;credit&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 40px;"&gt;200&lt;/TD&gt;
&lt;TD style="height: 19px; width: 40px;"&gt;1&lt;/TD&gt;
&lt;TD style="height: 19px; width: 46px;"&gt;USA&lt;/TD&gt;
&lt;TD style="height: 19px; width: 40px;"&gt;Irene&lt;/TD&gt;
&lt;TD style="height: 19px; width: 42px;"&gt;Tesla&lt;/TD&gt;
&lt;TD style="height: 19px; width: 42px;"&gt;cash&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;the "Name'"="Lita Wong" have a space in between. so when I export it to csv file, the the 'Name' shift to next row.&lt;/P&gt;
&lt;P&gt;I did not realize it shifted to the next row, I thought it was missing ID and visit after export to csv file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the output of csv looks like this:&lt;/P&gt;
&lt;TABLE width="330"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="43"&gt;ID&lt;/TD&gt;
&lt;TD width="72"&gt;visit&lt;/TD&gt;
&lt;TD width="51"&gt;value1&amp;nbsp;&lt;/TD&gt;
&lt;TD width="68"&gt;Name&lt;/TD&gt;
&lt;TD width="48"&gt;value3&lt;/TD&gt;
&lt;TD width="48"&gt;value4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;Asia&lt;/TD&gt;
&lt;TD&gt;Lita&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;wong&lt;/TD&gt;
&lt;TD&gt;Honda&lt;/TD&gt;
&lt;TD&gt;credit&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;USA&lt;/TD&gt;
&lt;TD&gt;Irene&lt;/TD&gt;
&lt;TD&gt;Tesla&lt;/TD&gt;
&lt;TD&gt;cash&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so after I deleted the space, from Lita Wong to Litawong, the csv file looked like this:&lt;/P&gt;
&lt;TABLE width="330"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="43"&gt;ID&lt;/TD&gt;
&lt;TD width="72"&gt;visit&lt;/TD&gt;
&lt;TD width="51"&gt;value1&amp;nbsp;&lt;/TD&gt;
&lt;TD width="68"&gt;Name&lt;/TD&gt;
&lt;TD width="48"&gt;value3&lt;/TD&gt;
&lt;TD width="48"&gt;value4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;Asia&lt;/TD&gt;
&lt;TD&gt;Litawong&lt;/TD&gt;
&lt;TD&gt;Honda&lt;/TD&gt;
&lt;TD&gt;credit&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;USA&lt;/TD&gt;
&lt;TD&gt;Irene&lt;/TD&gt;
&lt;TD&gt;Tesla&lt;/TD&gt;
&lt;TD&gt;cash&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;this is&amp;nbsp; what i expected, and then I saved it to excel file.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 16:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576689#M163271</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2019-07-25T16:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576692#M163273</link>
      <description>&lt;P&gt;That is not a space then.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is either a CR (ASCII code '0D'x) or a LF (ASCII code '0A'x) or perhaps both.&lt;/P&gt;
&lt;P&gt;You can remove them from the data?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name = compress(name,'0D0A'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or replace them with actual spaces.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name = translate(name,'  ','0D0A'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 16:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576692#M163273</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-25T16:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: problem export to csv file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576698#M163275</link>
      <description>&lt;P&gt;I think you are right, it's not just a space from the original file. it must be something in there?&lt;/P&gt;
&lt;P&gt;but I like the code you sent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 17:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-export-to-csv-file/m-p/576698#M163275</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2019-07-25T17:23:32Z</dc:date>
    </item>
  </channel>
</rss>

