<?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: Extra spaces in Char variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912393#M359686</link>
    <description>Thank you!</description>
    <pubDate>Sun, 21 Jan 2024 21:00:45 GMT</pubDate>
    <dc:creator>Smurf</dc:creator>
    <dc:date>2024-01-21T21:00:45Z</dc:date>
    <item>
      <title>Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912355#M359665</link>
      <description>&lt;P&gt;I have a char column that is display different in SAS studio data viewer and printed results;&lt;/P&gt;&lt;P&gt;In data viewer, it shows many extra spaces between words, but if I print the variable, it looks fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In data viewer&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Smurf_0-1705774995613.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92834i2BCEDBBF7E90BE87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Smurf_0-1705774995613.png" alt="Smurf_0-1705774995613.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result from proc print:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Smurf_1-1705775040306.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92835i28636530B6B80257/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Smurf_1-1705775040306.png" alt="Smurf_1-1705775040306.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look at the space between "Master" and "vs".&amp;nbsp; Could someone tell me why it's like this?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 18:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912355#M359665</guid>
      <dc:creator>Smurf</dc:creator>
      <dc:date>2024-01-20T18:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912357#M359666</link>
      <description>&lt;P&gt;Your problem is that you are using ODS to print your results.&amp;nbsp; If you print to the normal text output you won't have that problem.&amp;nbsp; Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input string $50.;
cards;
one two
one  two
one   two
one    two
one     two
;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Normal listing output:&lt;/P&gt;
&lt;PRE&gt;Obs    string

 1     one two
 2     one  two
 3     one   two
 4     one    two
 5     one     two
&lt;/PRE&gt;
&lt;P&gt;Picture of what ODS produces:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1705777909325.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92836i1FF199B9F2BCE707/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1705777909325.png" alt="Tom_0-1705777909325.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps there is a STYLE option that will preserve the spaces between "words", but I could not find it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 19:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912357#M359666</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-20T19:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912362#M359668</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use SAS Enterprise7.15.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Smurf_0-1705779154091.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92837i8A78007337A2D92F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Smurf_0-1705779154091.png" alt="Smurf_0-1705779154091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I print results to HTML format, the spaces will be removed. If I print to other formats, then spaces won't be removed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Html:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Smurf_1-1705779196060.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92838iCA4CB3AFAC0B30CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Smurf_1-1705779196060.png" alt="Smurf_1-1705779196060.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;rtf:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Smurf_2-1705779237518.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92839iBCA4F7FE441C4B69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Smurf_2-1705779237518.png" alt="Smurf_2-1705779237518.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that the display is controlled by neither data format nor style sheet.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 19:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912362#M359668</guid>
      <dc:creator>Smurf</dc:creator>
      <dc:date>2024-01-20T19:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912363#M359669</link>
      <description>&lt;P&gt;I got it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Extra spaces exist in data set and they can be removed by "compbl" function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ODS html may automatically call "compbl" before printing.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 20:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912363#M359669</guid>
      <dc:creator>Smurf</dc:creator>
      <dc:date>2024-01-20T20:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912376#M359676</link>
      <description>&lt;P&gt;Tom,&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;&lt;SPAN&gt;STYLE&amp;nbsp; option you are looking for is "ASIS=ON".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input string $50.;
cards;
one two
one  two
one   two
one    two
one     two
;

proc print style(column)={asis=on};
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1705827851202.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92840iAB0D7B28268A3C5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1705827851202.png" alt="Ksharp_0-1705827851202.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2024 09:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912376#M359676</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-01-21T09:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912387#M359684</link>
      <description>Thank you so much!&lt;BR /&gt;I didnot know styles worked so different on different ODS destinations.</description>
      <pubDate>Sun, 21 Jan 2024 18:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912387#M359684</guid>
      <dc:creator>Smurf</dc:creator>
      <dc:date>2024-01-21T18:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912392#M359685</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/337967"&gt;@Smurf&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I got it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extra spaces exist in data set and they can be removed by "compbl" function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ODS html may automatically call "compbl" before printing.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If the goal is to remove the extra spaces then COMPBL() is a good choice.&amp;nbsp; Be careful that some of that extra space are other invisible characters that COMPBL() will not remove. Such non-breaking space 'A0'x or tab '09'x.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not so much as HTML calling COMPBL() but just the nature of how HTML pages works.&amp;nbsp; If you build an HTML page by hand it will flow text into neat paragraphs for you.&amp;nbsp; If you want it to preserve white spaces you have to add extra code into the HTML.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2024 20:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912392#M359685</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-21T20:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Extra spaces in Char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912393#M359686</link>
      <description>Thank you!</description>
      <pubDate>Sun, 21 Jan 2024 21:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extra-spaces-in-Char-variable/m-p/912393#M359686</guid>
      <dc:creator>Smurf</dc:creator>
      <dc:date>2024-01-21T21:00:45Z</dc:date>
    </item>
  </channel>
</rss>

