<?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 Frequency analysis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466041#M118885</link>
    <description>&lt;P&gt;For example&amp;nbsp; I have this:&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;test1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test4&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp; NAATG&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp; HIV&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GRMS&lt;/P&gt;&lt;P&gt;321&amp;nbsp; &amp;nbsp; NAATR&amp;nbsp; &amp;nbsp; NAATU&lt;/P&gt;&lt;P&gt;145&amp;nbsp; &amp;nbsp; NAATR&amp;nbsp; &amp;nbsp; HCG&lt;/P&gt;&lt;P&gt;541&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; NAATR&lt;/P&gt;&lt;P&gt;654&amp;nbsp; &amp;nbsp;NAATG&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp; HIV&lt;/P&gt;&lt;P&gt;658&amp;nbsp; &amp;nbsp;NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp;NAATR&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on&lt;/P&gt;&lt;P&gt;i would like to find any NAAT test. by id. I don't want to get only one NAAT test. For example; ID 654 has two NAAT tests, but I only want one test by ID. Need your help please.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 May 2018 14:25:31 GMT</pubDate>
    <dc:creator>Dhana18</dc:creator>
    <dc:date>2018-05-30T14:25:31Z</dc:date>
    <item>
      <title>Frequency analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466041#M118885</link>
      <description>&lt;P&gt;For example&amp;nbsp; I have this:&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;test1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test4&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp; NAATG&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp; HIV&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GRMS&lt;/P&gt;&lt;P&gt;321&amp;nbsp; &amp;nbsp; NAATR&amp;nbsp; &amp;nbsp; NAATU&lt;/P&gt;&lt;P&gt;145&amp;nbsp; &amp;nbsp; NAATR&amp;nbsp; &amp;nbsp; HCG&lt;/P&gt;&lt;P&gt;541&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; NAATR&lt;/P&gt;&lt;P&gt;654&amp;nbsp; &amp;nbsp;NAATG&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp; HIV&lt;/P&gt;&lt;P&gt;658&amp;nbsp; &amp;nbsp;NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp;NAATR&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on&lt;/P&gt;&lt;P&gt;i would like to find any NAAT test. by id. I don't want to get only one NAAT test. For example; ID 654 has two NAAT tests, but I only want one test by ID. Need your help please.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 14:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466041#M118885</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2018-05-30T14:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466051#M118886</link>
      <description>&lt;P&gt;This is where the guidance on posting a good question come in handy.&amp;nbsp; From what you post, my answer would be:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  keep id test1;
run;&lt;/PRE&gt;
&lt;P&gt;Then you will have one NAAT per id.&amp;nbsp; I doubt that is what you want, but I have no other idea what you are talking about.&amp;nbsp; Post what you expect out, clarify what the issue is, and post test data in the form of a datastep.&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 14:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466051#M118886</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-30T14:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466064#M118891</link>
      <description>&lt;P&gt;You can use FIND()/INDEX() to see if the string contains the values NAAT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would use an array to loop over the strings and indicate if there was a NAAT value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*sample data - please provide data in this format in future posts;
data have;
infile cards truncover;
input id (test1-test4) ($);
cards;
123    NAATG    NAATP      HIV          GRMS
321    NAATR    NAATU
145    HCG    NAATR
541    NAATP    NAATR
654   NAATG    NAATP      HIV
658   NAATP     NAATR 
;
run;

data want;
set have;
*declare array of variables to loop over;
array test(*) $ test1-test4;

*set flag to 0 as default;
flag=0;

*loop control;
do index=1 to dim(test) while (flag=0); *do until found value;

    if find(test(index), 'NAAT')&amp;gt;0 then flag=1;

end;


run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212762"&gt;@Dhana18&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;For example&amp;nbsp; I have this:&lt;/P&gt;
&lt;P&gt;id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;test1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; test4&lt;/P&gt;
&lt;P&gt;123&amp;nbsp; &amp;nbsp; NAATG&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp; HIV&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GRMS&lt;/P&gt;
&lt;P&gt;321&amp;nbsp; &amp;nbsp; NAATR&amp;nbsp; &amp;nbsp; NAATU&lt;/P&gt;
&lt;P&gt;145&amp;nbsp; &amp;nbsp; NAATR&amp;nbsp; &amp;nbsp; HCG&lt;/P&gt;
&lt;P&gt;541&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; NAATR&lt;/P&gt;
&lt;P&gt;654&amp;nbsp; &amp;nbsp;NAATG&amp;nbsp; &amp;nbsp; NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp; HIV&lt;/P&gt;
&lt;P&gt;658&amp;nbsp; &amp;nbsp;NAATP&amp;nbsp; &amp;nbsp; &amp;nbsp;NAATR&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and so on&lt;/P&gt;
&lt;P&gt;i would like to find any NAAT test. by id. I don't want to get only one NAAT test. For example; ID 654 has two NAAT tests, but I only want one test by ID. Need your help please.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 14:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466064#M118891</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-30T14:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466069#M118896</link>
      <description>&lt;P&gt;Thank you. I have about 5131 observations of those 3438 are male and i am trying to find how many male has any kind of NAAT test. same person (id) has more than one NAAT test but i just want any NAAT test by male.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 14:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466069#M118896</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2018-05-30T14:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Frequency analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466077#M118901</link>
      <description>&lt;P&gt;You don't show a sex variable in your data set, so assuming one exists, you would just run a proc freq on the resulting table from my previous answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=want;
table sex*flag / out=NAAT_by_Sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 May 2018 15:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Frequency-analysis/m-p/466077#M118901</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-30T15:09:19Z</dc:date>
    </item>
  </channel>
</rss>

