<?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: Exporting datafile with macro adds (unwanted) extra blanks in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27905#M5151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about if you use the strip or right function to get rid of the extra spaces?&amp;nbsp; Of course, dependent on your code, you may have to wrap the function in a %sysfunc().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Jul 2011 23:38:33 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-07-07T23:38:33Z</dc:date>
    <item>
      <title>Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27904#M5150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code is the last part of my macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;proc export data = allperiods&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;outfile = "g/entitysheets/test&amp;amp;entityname..csv"&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;dbms = csv replace;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;run; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;The data is exported correctly, except I'd like the name to be (for example) testEntityX.csv. But what I'm getting is testEntityX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .csv. How can I get rid of those spaces without going through and deleting them manually?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;Thanks for the help!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 23:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27904#M5150</guid>
      <dc:creator>bballvas</dc:creator>
      <dc:date>2011-07-07T23:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27905#M5151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about if you use the strip or right function to get rid of the extra spaces?&amp;nbsp; Of course, dependent on your code, you may have to wrap the function in a %sysfunc().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 23:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27905#M5151</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-07T23:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27906#M5152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was looking into the strip function, but wasn't sure how I would use it on the file name (I'm new to SAS). Would I just say outfile =&amp;nbsp; strip("g/entitysheets/test&amp;amp;entityname..csv")?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 23:58:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27906#M5152</guid>
      <dc:creator>bballvas</dc:creator>
      <dc:date>2011-07-07T23:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27907#M5153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If spaces at the end of your macro variable are really the problem, you could progbably use it like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;g:\entitysheets\%sysfunc(strip(&amp;amp;entityname.)).csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 03:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27907#M5153</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-08T03:26:50Z</dc:date>
    </item>
    <item>
      <title>Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27908#M5154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not too different that Art's suggestion, but there's also the %trim() macro function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;format var $20.;&lt;/P&gt;&lt;P&gt;var = 'file_20110708';&lt;/P&gt;&lt;P&gt;call symput('var',var);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;var.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put filename is "c:\&amp;amp;var..csv";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put filename is "c:\%trim(&amp;amp;var.).csv";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 08:19:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27908#M5154</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-07-08T08:19:16Z</dc:date>
    </item>
    <item>
      <title>Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27909#M5155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can add %let &lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;entityname = &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-family: sans-serif; font-size: 10pt;"&gt;entityname; right before proc export and all the blanks are gone.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 11:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27909#M5155</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2011-07-08T11:14:47Z</dc:date>
    </item>
    <item>
      <title>Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27910#M5156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 13:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27910#M5156</guid>
      <dc:creator>bballvas</dc:creator>
      <dc:date>2011-07-08T13:25:10Z</dc:date>
    </item>
    <item>
      <title>Exporting datafile with macro adds (unwanted) extra blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27911#M5157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Everyone has suggested ways to FIX the problem after the fact.&amp;nbsp; You may want to reflect on how the value was created and address the issue there.&amp;nbsp; I suspect you created the value with CALL SYMPUT.&amp;nbsp; SYMPUT does not trim the value of its arguments.&amp;nbsp; You could use STRIP or TRIM with SYMPUT or use SYMPUTX a new version of SYMPUT that does STRIP the value of its arguments.&amp;nbsp; SYMPUTX also quietly converts numeric to character, and has a third parameter for SCOPE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; symputX(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'nx'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,_n_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'n'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,_n_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; NOTE: **&amp;amp;N** **&amp;amp;nx**;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 13:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-datafile-with-macro-adds-unwanted-extra-blanks/m-p/27911#M5157</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-07-08T13:45:54Z</dc:date>
    </item>
  </channel>
</rss>

