<?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 to export a SAS dataset into a readable CSV file on Unix. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305671#M65220</link>
    <description>&lt;P&gt;Thank you for getting back to me so quickly. I'm going to try and clarify my issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I'm creating the CSV via SAS, using a proc export :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data = test&lt;/P&gt;&lt;P&gt;outfile=" test.csv"&amp;nbsp;&lt;/P&gt;&lt;P&gt;dbms=csv&lt;/P&gt;&lt;P&gt;replace;&lt;/P&gt;&lt;P&gt;delimiter=" ;" ;&lt;/P&gt;&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS is running on a Unix server, but I'm executing my code from an Enterprise Guide client on a Windows machine. I hope that makes sense.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm trying to create a CSV file that I need to use in a subsequent sas program. This second program reads the csv with 0 observations, although if I open the file on my Windows, I can see all of the rows correctly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should also mention that I'm using Filezilla (so an FTP) to transfer the csv between Windows and Unix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even when I open the file from Unix with a simple text editor, I can still see my rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem only arises when I try and open the file stored on Unix with a SAS program.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm assuming that the problem comes from the file format difference between Unix and Windows, but do you have a different suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this in my log:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: 0 records were read from the infile "/mypath/test.csv"&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Oct 2016 14:07:47 GMT</pubDate>
    <dc:creator>Jbaax</dc:creator>
    <dc:date>2016-10-19T14:07:47Z</dc:date>
    <item>
      <title>Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305665#M65217</link>
      <description>&lt;P&gt;Hello everybody,&lt;BR /&gt;&lt;BR /&gt;I've a problem with exporting a SAS dataset into a readable CSV file on a Unix Server.&lt;BR /&gt;&lt;BR /&gt;First I've tried a proc export but when I load the result on the unix server, all the observations are unreadables.&lt;BR /&gt;Second, I've red the post :&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/PROC-Export-not-working-on-UNIX-because-of-terminal-option/m-p/78958#M22765" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/PROC-Export-not-working-on-UNIX-because-of-terminal-option/m-p/78958#M22765&lt;/A&gt; and trie the solution of Tom with a data _null_ but the CSV is already unreadable.&lt;BR /&gt;&lt;BR /&gt;Have you an idea to solve this problem ? Please help me to resolves this dos2unix problem !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS : However, if i'm opening my csv file on Excel, and i save it on CSV with Excel, the file is readable on Unix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 13:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305665#M65217</guid>
      <dc:creator>Jbaax</dc:creator>
      <dc:date>2016-10-19T13:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305668#M65219</link>
      <description>&lt;P&gt;Sorry, could we step back a bit here. &amp;nbsp;How are you creating the CSV, is this via SAS? &amp;nbsp;Is SAS on Unix or Windows? &amp;nbsp;What do you mean by "load the result"? &amp;nbsp;What is meant by "&lt;SPAN&gt;all the observations are unreadables" - unreadable by what? &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;First guess I would say is that carriage return/line feeds are different between Windows and Unix, from memory this needs to be changed if the file is created on one and opened in the other, for instance:&amp;nbsp;&lt;A href="http://support.sas.com/kb/14/178.html" target="_blank"&gt;http://support.sas.com/kb/14/178.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also note that CSV is not an Excel file, the two are different so make sure your "CSV" is plain text delimited file. &amp;nbsp;And if you need to transmit the file between OS's use FTP.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 13:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305668#M65219</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-19T13:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305671#M65220</link>
      <description>&lt;P&gt;Thank you for getting back to me so quickly. I'm going to try and clarify my issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I'm creating the CSV via SAS, using a proc export :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data = test&lt;/P&gt;&lt;P&gt;outfile=" test.csv"&amp;nbsp;&lt;/P&gt;&lt;P&gt;dbms=csv&lt;/P&gt;&lt;P&gt;replace;&lt;/P&gt;&lt;P&gt;delimiter=" ;" ;&lt;/P&gt;&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS is running on a Unix server, but I'm executing my code from an Enterprise Guide client on a Windows machine. I hope that makes sense.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm trying to create a CSV file that I need to use in a subsequent sas program. This second program reads the csv with 0 observations, although if I open the file on my Windows, I can see all of the rows correctly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should also mention that I'm using Filezilla (so an FTP) to transfer the csv between Windows and Unix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even when I open the file from Unix with a simple text editor, I can still see my rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem only arises when I try and open the file stored on Unix with a SAS program.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm assuming that the problem comes from the file format difference between Unix and Windows, but do you have a different suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this in my log:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: 0 records were read from the infile "/mypath/test.csv"&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 14:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305671#M65220</guid>
      <dc:creator>Jbaax</dc:creator>
      <dc:date>2016-10-19T14:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305674#M65222</link>
      <description>&lt;P&gt;At a guess - and I am just on my way out here so maybe someone else can pick up for a bit, it could be because of the delimiter. &amp;nbsp;CSV stands for&amp;nbsp;&lt;STRONG&gt;Comma&amp;nbsp;&lt;/STRONG&gt;Delimeted Variable file. &amp;nbsp;Looking at the code you have posted, you are putting a semicolon between data items, hence the file is&amp;nbsp;&lt;STRONG&gt;not&lt;/STRONG&gt; a CSV file. &amp;nbsp;When you read in that Delimited text file, make sure you specify semicolon as a delimiter. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However that being said you should stilll get some records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  infile "/mypath/test.csv";
  input;
  put _infile_;
run;&lt;/PRE&gt;
&lt;P&gt;Show? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 14:16:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305674#M65222</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-19T14:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305675#M65223</link>
      <description>&lt;P&gt;And exactly how are you opening the file stored on Unix with a SAS program?&lt;/P&gt;
&lt;P&gt;Reading with a data step, proc import or something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW you say you create a CSV but&amp;nbsp;your export says to use the semicolon as a delimiter. So if you try to read something as CSV with semicolons it won't work as the wrong delimiter is encountered.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 14:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305675#M65223</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-19T14:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305678#M65225</link>
      <description>&lt;P&gt;If you are creating the file on Unix and reading it on Unix then you should not have any troubles.&lt;/P&gt;
&lt;P&gt;If both the reading and writing steps are running on the same machine then make sure to use the same path to the file in both programs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the sample code you posted created a file with leading space in the filename. Perhaps you are creating one file and reading an older version of the file with a different name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are moving the file between systems then check if FTP is treating the file as binary or text. &amp;nbsp;If one method doesn't work then try other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a simple program to look at the file and make sure it has the data you expect. &amp;nbsp;Run it both after creating it and before trying to read it to confirm the file is the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile "test.csv" obs=5 ;
  input;
  list;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Oct 2016 14:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305678#M65225</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-10-19T14:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305679#M65226</link>
      <description>The ; is because my systems are French and in France csv is delimited by a semicolon (because numbers have , as a decimal point...). In fact I've found a solution that works, it's not when writing the csv file, but rather at the reading stage. The option that works for me is : infile "myfile.csv" encoding="utf-8" TERMSTR=LF dlm=";" missover dsd;</description>
      <pubDate>Wed, 19 Oct 2016 14:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305679#M65226</guid>
      <dc:creator>Jbaax</dc:creator>
      <dc:date>2016-10-19T14:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to export a SAS dataset into a readable CSV file on Unix.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305681#M65227</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Well, good that solved it. &amp;nbsp;Just to note however that CSV is a (pretty much) standard file format - the title is Comma Separated Variable. &amp;nbsp;What you have is a delimited file - thus it would be a good idea to name it appropriately (.txt) otherwise someone else will assume the file is comma delimited.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Comma-separated_values" target="_blank"&gt;https://en.wikipedia.org/wiki/Comma-separated_values&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 14:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-to-export-a-SAS-dataset-into-a-readable-CSV-file-on-Unix/m-p/305681#M65227</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-19T14:29:52Z</dc:date>
    </item>
  </channel>
</rss>

