<?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 Counting the frequency of a values in a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201742#M37656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I've stumbled on a problem that I'm having trouble figuring out how to approach.&amp;nbsp; At the title suggests, I have a variable "XCOMBINED" that contains a string of values that were concatenated from previously 15 distinct variables (X1-X15) with each numeric value being delineated by a space.&amp;nbsp; Therefore, in the "XCOMBINE" variable there could be anywhere from 1 to 15 numeric values that contain up to 5 characters each.&amp;nbsp; Is there a way to count or graph which of these values occurs the most frequently in the observations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, I also have all 15 variables separate.&amp;nbsp; Is there a way to determine the frequency of values in 15 different variables simultaneously?&amp;nbsp; Obviously I can plot X1 or X2 frequency individually, but I can't figure out a way to count the frequency of multiple variables in one graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Aug 2015 14:17:58 GMT</pubDate>
    <dc:creator>out_of_my_wheelhouse</dc:creator>
    <dc:date>2015-08-18T14:17:58Z</dc:date>
    <item>
      <title>Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201742#M37656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I've stumbled on a problem that I'm having trouble figuring out how to approach.&amp;nbsp; At the title suggests, I have a variable "XCOMBINED" that contains a string of values that were concatenated from previously 15 distinct variables (X1-X15) with each numeric value being delineated by a space.&amp;nbsp; Therefore, in the "XCOMBINE" variable there could be anywhere from 1 to 15 numeric values that contain up to 5 characters each.&amp;nbsp; Is there a way to count or graph which of these values occurs the most frequently in the observations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, I also have all 15 variables separate.&amp;nbsp; Is there a way to determine the frequency of values in 15 different variables simultaneously?&amp;nbsp; Obviously I can plot X1 or X2 frequency individually, but I can't figure out a way to count the frequency of multiple variables in one graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2015 14:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201742#M37656</guid>
      <dc:creator>out_of_my_wheelhouse</dc:creator>
      <dc:date>2015-08-18T14:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201743#M37657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Need to have some grouping variable/s&amp;lt;id&amp;gt; try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=x out=y;&lt;BR /&gt; by &amp;lt;id&amp;gt;;&lt;BR /&gt; var x1-x15;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc freq data=y;&lt;BR /&gt; tables &amp;lt;id&amp;gt;;&lt;BR /&gt; by _NAME_;&lt;BR /&gt; where nmiss(col1)=0;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2015 15:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201743#M37657</guid>
      <dc:creator>ndp</dc:creator>
      <dc:date>2015-08-18T15:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201744#M37658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for replying, but I'm a bit confused what &amp;lt;id&amp;gt; is meant to represent.&amp;nbsp; Can you explain?&amp;nbsp;&amp;nbsp; The log is telling me it's causing a syntax error.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2015 16:26:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201744#M37658</guid>
      <dc:creator>out_of_my_wheelhouse</dc:creator>
      <dc:date>2015-08-18T16:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201745#M37659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;id&amp;gt; is any variable/s you need to create counts by (grouping )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2015 23:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201745#M37659</guid>
      <dc:creator>ndp</dc:creator>
      <dc:date>2015-08-18T23:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201746#M37660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FYI if you post sample data you're more likely to get code that works for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The key here is to transpose your data from wide to long format. Then you can run a proc freq on all the results in one pass. I think proc freq even generates some standard graphs these days.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 01:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201746#M37660</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-08-19T01:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201747#M37661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza has the best answer here, normalise the data then aggregate it.&amp;nbsp; I would, just for fun, show an example of using arrays on the string you have:&lt;/P&gt;&lt;P&gt;data have;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; length xcombined $2000;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile datalines dlm="|";&lt;/P&gt;&lt;P&gt;&amp;nbsp; input xcombined $;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1234 567 1324 8723 56 56&lt;/P&gt;&lt;P&gt;673674 1235 1235 1235 2277 4564&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array elements{7,2} $20;&lt;/P&gt;&lt;P&gt;&amp;nbsp; curr_element=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do while (scan(xcombined,1," ") ne "");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; elements{curr_element,1}=scan(xcombined,1," ");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; elements{curr_element,2}=strip(put(count(xcombined,scan(xcombined,1," ")),best.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xcombined=strip(tranwrd(xcombined,scan(xcombined,1," "),""));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curr_element=curr_element+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This keeps taking the first word from the string, counting all occurences, and putting the output in a 2 dimensional array, i.e. value, count.&amp;nbsp; Then that word is removed from the string and we keep going until there is nothing left.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 09:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201747#M37661</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-08-19T09:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201748#M37662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First of all, thank you so much.&amp;nbsp; This is a surprisingly helpful community, especially for someone with zero experience with coding.&amp;nbsp; I posted a part of the example data I spoke about before in case I did a poor job explaining it.&amp;nbsp; This is obviously "dxcombine" instead of "xcombine" but I'm trying to accomplish the same thing.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="https://lh3.googleusercontent.com/HlmCrfIMzdijFduxMWCRMUHAdsAbh2ZtI1ePQcl_sNM=w204-h413-no" class="jive-image" src="https://lh3.googleusercontent.com/HlmCrfIMzdijFduxMWCRMUHAdsAbh2ZtI1ePQcl_sNM=w204-h413-no" /&gt;&lt;/P&gt;&lt;P&gt;I tried the example you posted, but I'm getting the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;581&amp;nbsp; data have;&lt;/P&gt;&lt;P&gt;582&lt;/P&gt;&lt;P&gt;583&amp;nbsp;&amp;nbsp;&amp;nbsp; length dxcombine $2000;&lt;/P&gt;&lt;P&gt;584&lt;/P&gt;&lt;P&gt;585&amp;nbsp;&amp;nbsp;&amp;nbsp; infile datalines dlm="|";&lt;/P&gt;&lt;P&gt;586&lt;/P&gt;&lt;P&gt;587&amp;nbsp;&amp;nbsp;&amp;nbsp; input dxcombine $;&lt;/P&gt;&lt;P&gt;588&lt;/P&gt;&lt;P&gt;589&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;NOTE: The data set WORK.HAVE has 5 observations and 1 variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;NOTE: DATA statement used (Total process time):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;595&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;596&lt;/P&gt;&lt;P&gt;597&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;598&lt;/P&gt;&lt;P&gt;599&amp;nbsp; data want;&lt;/P&gt;&lt;P&gt;600&lt;/P&gt;&lt;P&gt;601&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;602&lt;/P&gt;&lt;P&gt;603&amp;nbsp;&amp;nbsp;&amp;nbsp; array elements{7,2} $20;&lt;/P&gt;&lt;P&gt;604&lt;/P&gt;&lt;P&gt;605&amp;nbsp;&amp;nbsp;&amp;nbsp; curr_element=1;&lt;/P&gt;&lt;P&gt;606&lt;/P&gt;&lt;P&gt;607&amp;nbsp;&amp;nbsp;&amp;nbsp; do while (scan(dxcombine,1," ") ne "");&lt;/P&gt;&lt;P&gt;608&lt;/P&gt;&lt;P&gt;609&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elements{curr_element,1}=scan(dxcombine,1," ");&lt;/P&gt;&lt;P&gt;610&lt;/P&gt;&lt;P&gt;611&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elements{curr_element,2}=strip(put(count(dxcombine,scan(dxcombine,1," ")),best.));&lt;/P&gt;&lt;P&gt;612&lt;/P&gt;&lt;P&gt;613&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xcombined=strip(tranwrd(dxcombine,scan(dxcombine,1," "),""));&lt;/P&gt;&lt;P&gt;614&lt;/P&gt;&lt;P&gt;615&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curr_element=curr_element+1;&lt;/P&gt;&lt;P&gt;616&lt;/P&gt;&lt;P&gt;617&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;618&lt;/P&gt;&lt;P&gt;619&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;ERROR: Array subscript out of range at line 609 column 5.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dxcombine=1234 567 1324 8723 56 56 elements1=1234 elements2=1 elements3=1234 elements4=1&lt;/P&gt;&lt;P&gt;elements5=1234 elements6=1 elements7=1234 elements8=1 elements9=1234 elements10=1&lt;/P&gt;&lt;P&gt;elements11=1234 elements12=1 elements13=1234 elements14=1 curr_element=8&lt;/P&gt;&lt;P&gt;xcombined=567 1324 8723 56 56 _ERROR_=1 _N_=2&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;NOTE: There were 2 observations read from the data set WORK.HAVE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;WARNING: The data set WORK.WANT may be incomplete.&amp;nbsp; When this step was stopped there were 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; observations and 17 variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;WARNING: Data set WORK.WANT was not replaced because this step was stopped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;NOTE: DATA statement used (Total process time):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.02 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.03 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 11:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201748#M37662</guid>
      <dc:creator>out_of_my_wheelhouse</dc:creator>
      <dc:date>2015-08-19T11:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the frequency of a values in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201749#M37663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is down to the value I hardcoded in this row:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;603&amp;nbsp;&amp;nbsp;&amp;nbsp; array elements{7,2} $20;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I am assuming there will be no more than 7 distinct elements in the string, this is just the test data I have at the time.&amp;nbsp; Set it to elements{20,2} and that should cover it.&amp;nbsp; I does however illustrate neatly why Reeza's answer is the better of the two.&amp;nbsp; If you normalise your data:&lt;/P&gt;&lt;P&gt;ROW&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5849&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 42822&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 41071&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can very easily run a freq/means procedure, or some simple code to get your result:&lt;/P&gt;&lt;P&gt;proc sq;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table WANT as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROW,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(DX) as RESULT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HAVE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by ROW,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now to get the normalised data you can just do:&lt;/P&gt;&lt;P&gt;data inter (keep=row dx);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do until (scan(dxcombine,i,' ') = '');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row=_n_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dx=scan(dxcombine,i,' ');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=i+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;This outputs one row per scanned word.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 12:53:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-the-frequency-of-a-values-in-a-string/m-p/201749#M37663</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-08-19T12:53:30Z</dc:date>
    </item>
  </channel>
</rss>

