<?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: Why are spaces still counted as delimiters after specifying delimiters in SCAN function? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844408#M333825</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/431484"&gt;@Nietzsche&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;why is it that in the result, the spaces are still removed even though I specified delimiters to be only a comma?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The default Style option for displaying almost anything for Proc Print and other ODS tables is ASIS=OFF, which ignores leading spaces. You can change that behavior by overriding the Style setting:&lt;/P&gt;
&lt;PRE&gt;data example;
   length x $10;
   x='ABC';output;
   x='   ABC';output;
run;

proc print noobs data=example;
  var x;
  title 'Default ods behavior';
run;  title;

proc Print noobs data=example  
   style(data)=[asis=on]
;
   var x;
  title "Style ASIS=on";
run;title;&lt;/PRE&gt;
&lt;P&gt;Not all procedures have nice ways to override this behavior and may have to send to output to data sets and use Proc Print, Report or Tabulate to display the data set where you can provide the override.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Nov 2022 16:03:05 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-11-15T16:03:05Z</dc:date>
    <item>
      <title>Why are spaces still counted as delimiters after specifying delimiters in SCAN function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844281#M333781</link>
      <description>&lt;P&gt;Hi I am reading page 278 of the official specialist prep guide.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nietzsche_0-1668488868183.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77301i5BDE3CDD9E8EF616/image-size/large?v=v2&amp;amp;px=999" role="button" title="Nietzsche_0-1668488868183.png" alt="Nietzsche_0-1668488868183.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as you can see from the statement above, there is a space before NY in the above sentence.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so if I use the SCAN function and I specify my delimiters as just a comma with ',' in the third argument in the SCAN function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data temp;
	set cert.staff;
	test=scan("209 RADCLIFFE ROAD, CENTER CITY, NY, 92716",3,',');
run;

proc print data=temp;run;

&lt;/PRE&gt;
&lt;P&gt;why is it that in the result, the spaces are still removed even though I specified delimiters to be only a comma?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nietzsche_1-1668489742363.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77302iE46EA8481C6258D7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Nietzsche_1-1668489742363.png" alt="Nietzsche_1-1668489742363.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 05:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844281#M333781</guid>
      <dc:creator>Nietzsche</dc:creator>
      <dc:date>2022-11-15T05:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why are spaces still counted as delimiters after specifying delimiters in SCAN function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844285#M333782</link>
      <description>&lt;P&gt;This is just a feature of html: leading spaces are removed automatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: Replacing blanks with underscores shows the real value in html, too:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
   test = scan("209 RADCLIFFE ROAD, CENTER CITY, NY, 92716", 3, ',');
   test = translate(test, '_', ' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2022 06:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844285#M333782</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-11-15T06:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why are spaces still counted as delimiters after specifying delimiters in SCAN function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844382#M333817</link>
      <description>&lt;P&gt;The leading space is not removed, and was not counted as a delimiter.&lt;/P&gt;
&lt;P&gt;The space is in the value:&lt;/P&gt;
&lt;PRE&gt;1    data temp;
2      test=scan("209 RADCLIFFE ROAD, CENTER CITY, NY, 92716",3,',');
3      if test="NY" then put "space was removed" ;
4      else if test=" NY" then put "space was not removed" ;
5    run;

space was not removed
NOTE: The data set WORK.TEMP has 1 observations and 1 variables.
&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2022 14:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844382#M333817</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-15T14:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why are spaces still counted as delimiters after specifying delimiters in SCAN function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844384#M333818</link>
      <description>&lt;P&gt;The last image looks to be the output generated using ODS.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ODS does NOT preserve leading spaces.&lt;/P&gt;
&lt;P&gt;Look at the PROC PRINT that is generated to the LISTING (plain old text file) output to see the leading space(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or attach the $QUOTE format to the variable so that ODS will not eat the leading space since there will then be a quote character in front of it.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 14:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844384#M333818</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-15T14:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why are spaces still counted as delimiters after specifying delimiters in SCAN function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844408#M333825</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/431484"&gt;@Nietzsche&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;why is it that in the result, the spaces are still removed even though I specified delimiters to be only a comma?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The default Style option for displaying almost anything for Proc Print and other ODS tables is ASIS=OFF, which ignores leading spaces. You can change that behavior by overriding the Style setting:&lt;/P&gt;
&lt;PRE&gt;data example;
   length x $10;
   x='ABC';output;
   x='   ABC';output;
run;

proc print noobs data=example;
  var x;
  title 'Default ods behavior';
run;  title;

proc Print noobs data=example  
   style(data)=[asis=on]
;
   var x;
  title "Style ASIS=on";
run;title;&lt;/PRE&gt;
&lt;P&gt;Not all procedures have nice ways to override this behavior and may have to send to output to data sets and use Proc Print, Report or Tabulate to display the data set where you can provide the override.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 16:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-spaces-still-counted-as-delimiters-after-specifying/m-p/844408#M333825</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-11-15T16:03:05Z</dc:date>
    </item>
  </channel>
</rss>

