<?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: Preencher espaço branco in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334485#M272230</link>
    <description>&lt;P&gt;&lt;EM&gt;I did the test and still the field does not fill in the blanks at the end, however every time I mouse in the field it says that the field size is equal to 49&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That's what I'm trying to tell you: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The actual variable is "filled up with blanks" to the end of the length of the variable. That doesn't mean it always prints this way ("print" refers to any way you can look at it).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You must actually be aware of this "filled-up" state i.e. when you concatenate variables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;result=myvar1||myvar2;&lt;/EM&gt; is different from &lt;EM&gt;result=trim(myvar1)||myvar2;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length result $20 myVar1 myVar2 $10;
  myVar1='A';
  myvar2='B';
  result=myvar1||myvar2;
  output;
  result=trim(myvar1)||myvar2;
  output;
run;
proc print data=test;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                       my      my
Obs    result         Var1    Var2

 1     A         B     A       B  
 2     AB              A       B  
&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2017 22:07:37 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-02-20T22:07:37Z</dc:date>
    <item>
      <title>Preencher espaço branco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334451#M272225</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a problem, I'm developing a "SQL PROC" and it has a String field, I need to fill in this field with blanks at the end of the field.&lt;/P&gt;&lt;P&gt;Does anyone have a solution for this case?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 20:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334451#M272225</guid>
      <dc:creator>drocumback</dc:creator>
      <dc:date>2017-02-20T20:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Preencher espaço branco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334462#M272226</link>
      <description>&lt;P&gt;SAS variables of type Character are by "default" filled up with blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's the problem you're having? A newly created character variable not being long enough, or not printing with all the blanks, or....?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 21:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334462#M272226</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-02-20T21:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Preencher espaço branco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334465#M272227</link>
      <description>So I have a Character variable, I'm creating a " PROC SQL", and a field has a content that in the end needs to fill in empty spaces.&lt;BR /&gt;&lt;BR /&gt;Example: "00001-test" --- Result: "00001-test "&lt;BR /&gt;&lt;BR /&gt;In this example I filled out 10 empty spaces.</description>
      <pubDate>Mon, 20 Feb 2017 21:13:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334465#M272227</guid>
      <dc:creator>drocumback</dc:creator>
      <dc:date>2017-02-20T21:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Preencher espaço branco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334472#M272228</link>
      <description>&lt;P&gt;&lt;EM&gt;a field has a content that in the end needs to fill in empty spaces&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's something you don't need to do. A SAS character variable has a fixed length and gets always filled up with blanks at the end up to the defined length of this variable. It then also occupies memory and disk space for the full length - that's why with large character variables where you only save short strings in average option "compress=yes" will save you disk space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you create a new variable in a data step or a proc sql then use a LENGTH statement to define the variable. If you omit the LENGTH statement then SAS will define the variable implicitely with a length which is equal to the length of the string assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table test as
  select 
    "00001-test" as myVar_1 length=20,
    "00001-test" as myVar_2
  from sashelp.class(obs=1)
  ;
quit;

proc contents data=test;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 21:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334472#M272228</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-02-20T21:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Preencher espaço branco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334482#M272229</link>
      <description>Many thanks for the feedback and help Patrick.&lt;BR /&gt;&lt;BR /&gt;I did the test and still the field does not fill in the blanks at the end, however every time I mouse in the field it says that the field size is equal to 49, but the spaces on the right are not filled.&lt;BR /&gt;&lt;BR /&gt;Note (I took the "compress = yes" option to perform this test).&lt;BR /&gt;&lt;BR /&gt;Thank you.</description>
      <pubDate>Mon, 20 Feb 2017 21:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334482#M272229</guid>
      <dc:creator>drocumback</dc:creator>
      <dc:date>2017-02-20T21:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Preencher espaço branco</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334485#M272230</link>
      <description>&lt;P&gt;&lt;EM&gt;I did the test and still the field does not fill in the blanks at the end, however every time I mouse in the field it says that the field size is equal to 49&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That's what I'm trying to tell you: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The actual variable is "filled up with blanks" to the end of the length of the variable. That doesn't mean it always prints this way ("print" refers to any way you can look at it).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You must actually be aware of this "filled-up" state i.e. when you concatenate variables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;result=myvar1||myvar2;&lt;/EM&gt; is different from &lt;EM&gt;result=trim(myvar1)||myvar2;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length result $20 myVar1 myVar2 $10;
  myVar1='A';
  myvar2='B';
  result=myvar1||myvar2;
  output;
  result=trim(myvar1)||myvar2;
  output;
run;
proc print data=test;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                       my      my
Obs    result         Var1    Var2

 1     A         B     A       B  
 2     AB              A       B  
&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 22:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preencher-espa%C3%A7o-branco/m-p/334485#M272230</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-02-20T22:07:37Z</dc:date>
    </item>
  </channel>
</rss>

