<?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: Add one blank (space) at the end of a character var, an then export to .txt in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265280#M18406</link>
    <description>&lt;P&gt;You can make both blank and | as delimiter :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sashelp.class;
file '/folders/myfolders/xx.txt' dlmstr=' |';
put (_all_) (:);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 21 Apr 2016 01:44:23 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-04-21T01:44:23Z</dc:date>
    <item>
      <title>Add one blank (space) at the end of a character var, an then export to .txt</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265248#M18403</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Can someone help please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;How can I add an extra blank at the end of a character variable and then export it to a .TXT file with the blank at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have tried to concatenate name = name || " "; but doesn't work. Please see the code below (just copy and paste):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The problem is to add an extra blank, the proc export is working fine, but without the extra blank at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input name &amp;amp; $2.;
datalines;
a
;
run;

data have1;
set have1;
name = name || " ";
run;

PROC EXPORT DATA = have1 OUTFILE = '/sas/teste.TXT' REPLACE ;
PUTNAMES=NO;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2016 21:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265248#M18403</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-04-20T21:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add one blank (space) at the end of a character var, an then export to .txt</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265263#M18404</link>
      <description>&lt;P&gt;It's not too difficult to program it yourself:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;file '/sas/teste.txt' noprint;&lt;/P&gt;
&lt;P&gt;put name $3.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's still a question of delimiters between fields, which fields you really need to write out, whether to add a blank after numerics, etc. &amp;nbsp;But you can program it yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't add a blank to the end of the variable NAME, because its length doesn't change. &amp;nbsp;Given that NAME is defined as having a length of 2, this statement will not change the value of NAME:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;name = name || 'abcde';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's only room for 2 characters, so "abcde" doesn't fit and gets truncated.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 22:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265263#M18404</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-20T22:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add one blank (space) at the end of a character var, an then export to .txt</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265265#M18405</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@anonymous_user﻿,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--- I see,&amp;nbsp;@Astounding was faster ---&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note that your second data step is redundant in two ways:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Variable NAME has length 2 (thanks to your informat specification $2.), hence it contains already the desired trailing blank after 'a'.&lt;/LI&gt;
&lt;LI&gt;Whatever you tried to append using&amp;nbsp;&lt;BR /&gt;
&lt;PRE&gt;name = name || "&lt;EM&gt;whatever&lt;/EM&gt;"&lt;/PRE&gt;
it would not appear in variable NAME, because the expression right of the equals sign would append it&amp;nbsp;&lt;U&gt;after&lt;/U&gt; the last character of NAME (i.e. after the trailing blank), but there is no room for a third, fourth, ... character in variable NAME (left of the equals sign) because of its length 2.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The problem with PROC EXPORT is that this procedure uses (what is called) &lt;EM&gt;list&lt;/EM&gt; output, as can be seen in the log of the PROC step:&lt;/P&gt;
&lt;PRE&gt;put name $ ;&lt;/PRE&gt;
&lt;P&gt;This will always shed trailing blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you need is &lt;EM&gt;formatted&lt;/EM&gt; output:&lt;/P&gt;
&lt;PRE&gt;put name $2.;&lt;/PRE&gt;
&lt;P&gt;So, you could use the DATA _NULL_ step from the log of PROC EXPORT as a basis and modify it to use formatted output, as shown above.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 22:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265265#M18405</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-20T22:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add one blank (space) at the end of a character var, an then export to .txt</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265280#M18406</link>
      <description>&lt;P&gt;You can make both blank and | as delimiter :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sashelp.class;
file '/folders/myfolders/xx.txt' dlmstr=' |';
put (_all_) (:);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Apr 2016 01:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265280#M18406</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-21T01:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add one blank (space) at the end of a character var, an then export to .txt</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265380#M18419</link>
      <description>&lt;P&gt;Odd request. What kind of receiving&amp;nbsp;system needs a trailing blank to do it's import?&lt;/P&gt;
&lt;P&gt;I think interchanged&amp;nbsp;data should be as clean as possible, and adding extra blanks generally doesn't add any value to the data.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 10:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265380#M18419</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-21T10:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add one blank (space) at the end of a character var, an then export to .txt</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265524#M18424</link>
      <description>&lt;P&gt;The recieving system will use the .txt file to update a table on the mainframe, so when the program reads blank it wont change that specific info, when it is &amp;lt;&amp;gt; from blank he updates the record. Don't know exactly why it works like that, but that the way it is.&lt;/P&gt;
&lt;P&gt;Thanks and regards!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 20:34:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Add-one-blank-space-at-the-end-of-a-character-var-an-then-export/m-p/265524#M18424</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-04-21T20:34:52Z</dc:date>
    </item>
  </channel>
</rss>

