<?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: Removing last comma in csv file from a proc export in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499272#M132826</link>
    <description>&lt;P&gt;Change&lt;/P&gt;
&lt;PRE&gt;proc export data=dt&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc export data=dt(drop=lastvar)&lt;/PRE&gt;
&lt;P&gt;replace lastvar with the last variable in the data set. You get the "extra" comma or pipe because you have a variable that is all missing values.&lt;/P&gt;
&lt;P&gt;OR much less likely&amp;nbsp;the values of your last variable&amp;nbsp;end with a comma. At which point you need to modify your data set.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Sep 2018 21:16:42 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-09-26T21:16:42Z</dc:date>
    <item>
      <title>Removing last comma in csv file from a proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499247#M132810</link>
      <description>&lt;P&gt;Hi, I am trying to export a csv file from a SAS dataset I created, but I am trying to figure out a way to get rid of the last comma that shows up when I view the csv file in notepad. Is there a way of doing this? Any help is greatly appreciated! Thank you!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is the code I am using to export my dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data=dt&lt;BR /&gt;&amp;nbsp;&amp;nbsp; outfile="&amp;amp;Outpath.&amp;amp;outfile..csv"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dbms=csv replace;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; delimiter='|';&lt;BR /&gt;&amp;nbsp;run;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 20:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499247#M132810</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2018-09-26T20:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last comma in csv file from a proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499252#M132814</link>
      <description>&lt;P&gt;You've specified the delimiter as a pipe, that isn't a csv file. I would recommend the following changes:&lt;/P&gt;
&lt;P&gt;1. Change it to a txt file, since it's a pipe delimited text file&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;Change DMBS to DLM (delimited) rather than CSV&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=dt
   outfile="&amp;amp;Outpath.&amp;amp;outfile..txt"
   dbms=DLM replace;
   delimiter='|';
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139341"&gt;@kmardinian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I am trying to export a csv file from a SAS dataset I created, but I am trying to figure out a way to get rid of the last comma that shows up when I view the csv file in notepad. Is there a way of doing this? Any help is greatly appreciated! Thank you!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This is the code I am using to export my dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=dt&lt;BR /&gt;&amp;nbsp;&amp;nbsp; outfile="&amp;amp;Outpath.&amp;amp;outfile..csv"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dbms=csv replace;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; delimiter='|';&lt;BR /&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 20:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499252#M132814</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-26T20:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last comma in csv file from a proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499253#M132815</link>
      <description>&lt;P&gt;I see, do you know if that would be the only way to do this. There isn't a possibility of fixing this issue, but also keeping it as a csv file? A csv file is what I wanted the output to be in.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 20:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499253#M132815</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2018-09-26T20:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last comma in csv file from a proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499256#M132816</link>
      <description>&lt;P&gt;csv means&amp;nbsp;&lt;STRONG&gt;c&lt;/STRONG&gt;omma&amp;nbsp;&lt;STRONG&gt;s&lt;/STRONG&gt;eparated&amp;nbsp;&lt;STRONG&gt;v&lt;/STRONG&gt;olume, so it does not use pipes as delimiter, but commas.&lt;/P&gt;
&lt;P&gt;Anyway, anytime the last column in the SAS dataset is empty, the corresponding line in the output will end with a delimiter, per definition.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 20:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499256#M132816</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-26T20:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last comma in csv file from a proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499268#M132823</link>
      <description>&lt;P&gt;You can name it whatever you want, but it's not a CSV file. The reason to not do this is to avoid confusion from end users.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can leave the extension as CSV and make the other changes (DBMS).&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139341"&gt;@kmardinian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I see, do you know if that would be the only way to do this. There isn't a possibility of fixing this issue, but also keeping it as a csv file? A csv file is what I wanted the output to be in.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 21:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499268#M132823</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-26T21:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last comma in csv file from a proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499272#M132826</link>
      <description>&lt;P&gt;Change&lt;/P&gt;
&lt;PRE&gt;proc export data=dt&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc export data=dt(drop=lastvar)&lt;/PRE&gt;
&lt;P&gt;replace lastvar with the last variable in the data set. You get the "extra" comma or pipe because you have a variable that is all missing values.&lt;/P&gt;
&lt;P&gt;OR much less likely&amp;nbsp;the values of your last variable&amp;nbsp;end with a comma. At which point you need to modify your data set.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 21:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-last-comma-in-csv-file-from-a-proc-export/m-p/499272#M132826</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-26T21:16:42Z</dc:date>
    </item>
  </channel>
</rss>

