<?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: Characters count across many columns in the dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345386#M79458</link>
    <description>&lt;P&gt;Overall Counts in the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 29 Mar 2017 14:22:52 GMT</pubDate>
    <dc:creator>Sujithpeta</dc:creator>
    <dc:date>2017-03-29T14:22:52Z</dc:date>
    <item>
      <title>Characters count across many columns in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345376#M79455</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA A.IP_Bene;
SET "/sas/raw4/WD1/ccaei121.sas7bdat";
	ARRAY ICD {15} DX1-DX15;
	DO i = 1 to 15;
		IF ICD {i} in ("45341", "45340", "45342", "45350", "45351", "45352", "45181", "45111", "45119", "41511", "41512", "41513", "41519") THEN DO; 
		OUTPUT; 
		LEAVE; 
		END;
	END;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above SAS code creates a dataset whos row have any of these strings ("45341", "45340", "45342", "45350", "45351", "45352", "45181", "45111", "45119", "41511", "41512", "41513", "41519") across 15 columns in the dataset.&lt;/P&gt;&lt;P&gt;How can I modify this code so that I can get count(No.of times the value appeared in the 15 columns) as following:&lt;/P&gt;&lt;P&gt;&lt;U&gt;Description&lt;/U&gt; &amp;nbsp; &lt;U&gt;Count&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 45341 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 45340 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 45342 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Z&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and so on....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;--Sujith&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 14:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345376#M79455</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2017-03-29T14:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Characters count across many columns in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345381#M79457</link>
      <description>&lt;P&gt;Do you want the overall counts for the file OR separately for each record?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 14:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345381#M79457</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-29T14:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Characters count across many columns in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345386#M79458</link>
      <description>&lt;P&gt;Overall Counts in the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 14:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345386#M79458</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2017-03-29T14:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Characters count across many columns in the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345388#M79459</link>
      <description>&lt;P&gt;The following modification of your current code would do what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA for_count (keep=_icd rename=(_icd=icd));
  SET ccaei121;
  ARRAY ICD {15} DX1-DX15;
  DO i = 1 to 15;
    IF ICD {i} in ("45341", "45340", "45342", "45350", "45351", "45352", "45181", "45111", "45119", "41511", "41512", "41513", "41519") THEN DO; 
      _icd=icd(i);
      OUTPUT; 
    END;
  END;
RUN;

proc freq data=for_count;
  tables icd;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 14:28:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Characters-count-across-many-columns-in-the-dataset/m-p/345388#M79459</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-29T14:28:52Z</dc:date>
    </item>
  </channel>
</rss>

