<?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: count c in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702803#M25948</link>
    <description>&lt;P&gt;indeed, so on that basis, results should be identical as in blank variable i used strip function, which removed the leading and trailing blanks. But when i used x variable (x=countc(blank," ");)with countc function, still showing spaces, not in y variable case(y=countc(strip(Agency)," ");)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2020 13:53:08 GMT</pubDate>
    <dc:creator>Naveen1111</dc:creator>
    <dc:date>2020-12-01T13:53:08Z</dc:date>
    <item>
      <title>count c</title>
      <link>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702799#M25946</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have used the talent dataset. Could someone tell me why there is a difference between x and y results?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data tp;&lt;BR /&gt;set sasuser.talent;&lt;BR /&gt;blank=strip(Agency);&lt;BR /&gt;x=countc(blank," ");&lt;BR /&gt;y=countc(strip(Agency)," ");&lt;/P&gt;&lt;P&gt;keep&amp;nbsp;blank x y Agency;&lt;/P&gt;&lt;P&gt;run;&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;&lt;P&gt;results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs Agency blank x y&lt;/P&gt;&lt;P&gt;1 TALENT TALENT TALENT TALENT TALENT TALENT 2 2&lt;BR /&gt;2 GEORGE STICKS GEORGE STICKS 8 1&lt;BR /&gt;3 UNIVERSAL UNIVERSAL 11 0&lt;BR /&gt;4 HORIZONS HORIZONS 12 0&lt;BR /&gt;5 SYCAMORE SYCAMORE 12 0&lt;BR /&gt;6 GOLDEN GUILD GOLDEN GUILD 9 1&lt;BR /&gt;7 GOLDEN GUILD GOLDEN GUILD 9 1&lt;BR /&gt;8 ACTORS SQUARE ACTORS SQUARE 8 1&lt;BR /&gt;9 LAURELS LAURELS 13 0&lt;BR /&gt;10 ARTS TALENT ARTS TALENT 10 1&lt;BR /&gt;11 FINDERS FINDERS 13 0&lt;BR /&gt;12 ALL STARS ALL STARS 12 1&lt;BR /&gt;13 ALL STARS ALL STARS 12 1&lt;BR /&gt;14 ALL STARS ALL STARS 12 1&lt;BR /&gt;15 UNLIMITED UNLIMITED 11 0&lt;BR /&gt;16 STARS AND STRIPES STARS AND STRIPES 5 2&lt;BR /&gt;17 SETTINGS SETTINGS 12 0&lt;BR /&gt;18 STARS AND STRIPES STARS AND STRIPES 5 2&lt;BR /&gt;19 UNIVERSAL LIGHTS UNIVERSAL LIGHTS 5 1&lt;BR /&gt;20 MODELS AND MAGIC MODELS AND MAGIC 6 2&lt;BR /&gt;21 HORIZONS HORIZONS 12 0&lt;BR /&gt;22 HARDY STELSON HARDY STELSON 8 1&lt;BR /&gt;23 AKA TALENT AKA TALENT 11 1&lt;BR /&gt;24 MODELS AND MAGIC MODELS AND MAGIC 6 2&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 13:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702799#M25946</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-12-01T13:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: count c</title>
      <link>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702800#M25947</link>
      <description>&lt;P&gt;Because you have leading and/or trailing blanks in your input variable. The &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0xk6tl87f4b4qn1sp1ywen1ntan.htm&amp;amp;locale=en" target="_self"&gt;Strip Function&lt;/A&gt; removes them&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   a  = ' abc  ';
   ca = countc(a, ' ');
   cb = countc(strip(a), ' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 13:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702800#M25947</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-12-01T13:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: count c</title>
      <link>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702803#M25948</link>
      <description>&lt;P&gt;indeed, so on that basis, results should be identical as in blank variable i used strip function, which removed the leading and trailing blanks. But when i used x variable (x=countc(blank," ");)with countc function, still showing spaces, not in y variable case(y=countc(strip(Agency)," ");)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 13:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702803#M25948</guid>
      <dc:creator>Naveen1111</dc:creator>
      <dc:date>2020-12-01T13:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: count c</title>
      <link>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702809#M25951</link>
      <description>&lt;P&gt;I'm not sure what you mean by this?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 14:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702809#M25951</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-12-01T14:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: count c</title>
      <link>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702821#M25955</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327047"&gt;@Naveen1111&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;indeed, so on that basis, results should be identical as in blank variable i used strip function, which removed the leading and trailing blanks. But when i used x variable (x=countc(blank," ");)with countc function, still showing spaces, not in y variable case(y=countc(strip(Agency)," ");)&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 variable Blank, when created is the same length as agency. As such it will be padded at the end with blanks.&lt;/P&gt;
&lt;P&gt;Example below shows the result of a "stripped" variable sandwiched between : characters. Countc counts them unless explicitly stripped at the time of counting.&lt;/P&gt;
&lt;PRE&gt;data example;
   x='   Some string with lead and trail blanks  ';
   blank=strip(x);
   string= ':'||blank||':';
   y=countc(string,"");
   put string=;
run;&lt;/PRE&gt;
&lt;P&gt;Look in the log to see value of string.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 15:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/count-c/m-p/702821#M25955</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-01T15:32:15Z</dc:date>
    </item>
  </channel>
</rss>

