<?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: counting values of variables in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23655#M1026</link>
    <description>Finally got to find out the soultion of using sum(of function which considers missing values. This solved the problem.&lt;BR /&gt;
Thanks for all your helping tips.</description>
    <pubDate>Fri, 06 Jun 2008 19:40:49 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-06-06T19:40:49Z</dc:date>
    <item>
      <title>counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23649#M1020</link>
      <description>How do I count the values of a variable for a particular customerid?&lt;BR /&gt;
Example;&lt;BR /&gt;
I need to count the value of void &amp;amp; smoke for distinct customers&lt;BR /&gt;
&lt;BR /&gt;
Customerid void smoke&lt;BR /&gt;
 12001	1	2&lt;BR /&gt;
 12001	1	4&lt;BR /&gt;
 12001	1	3&lt;BR /&gt;
 12004	1	2&lt;BR /&gt;
 12004	1	4&lt;BR /&gt;
 12005	1	3&lt;BR /&gt;
 12005	1	3&lt;BR /&gt;
 12005	1	2&lt;BR /&gt;
 12006	1	4&lt;BR /&gt;
 12006	1	3&lt;BR /&gt;
 12007	1	2&lt;BR /&gt;
 12007	1	4&lt;BR /&gt;
 12007	1	3&lt;BR /&gt;
 12007	1	3&lt;BR /&gt;
&lt;BR /&gt;
I have around 9999 obs in the datasets.&lt;BR /&gt;
I tried PROC SQL but didn't get expected results.&lt;BR /&gt;
Any help would be appreciated.&lt;BR /&gt;
Thanx.&lt;BR /&gt;
Priya</description>
      <pubDate>Thu, 05 Jun 2008 19:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23649#M1020</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-05T19:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23650#M1021</link>
      <description>hai priya,&lt;BR /&gt;
&lt;BR /&gt;
i saw your post. as per my knowledge if you exactly want the count od void and smoke for each id. then in sas, as of my knowledge several procedures are there.&lt;BR /&gt;
the one way came to my mind is you can run &lt;BR /&gt;
 &lt;BR /&gt;
proc tabulate procedure .&lt;BR /&gt;
proc tabulate data=&lt;DATASET&gt;;&lt;BR /&gt;
class id void smoke;&lt;BR /&gt;
table id, (void smoke) n;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
if any others answers please let us know. &lt;BR /&gt;
&lt;BR /&gt;
thanks,&lt;BR /&gt;
bhav&lt;/DATASET&gt;</description>
      <pubDate>Thu, 05 Jun 2008 20:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23650#M1021</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-05T20:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23651#M1022</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
If such a requirement comes to me, I try to solve it using data step.  You can get the desired result by using retain statement.  Consider the total of void and total of smoke as tvoid and tsmoke.  &lt;BR /&gt;
&lt;BR /&gt;
I created a datatset using the values you have given and named it 'New', and sorted it by custid.&lt;BR /&gt;
&lt;BR /&gt;
DATA new1 (DROP=void smoke);&lt;BR /&gt;
SET new;&lt;BR /&gt;
BY custid;&lt;BR /&gt;
RETAIN tvoid tsmoke;&lt;BR /&gt;
IF first.custid THEN DO;&lt;BR /&gt;
                                   tvoid=.;&lt;BR /&gt;
                                    tsmoke=.;&lt;BR /&gt;
                             END;&lt;BR /&gt;
tvoid+void;&lt;BR /&gt;
tsmoke+smoke;&lt;BR /&gt;
IF last.custid THEN OUTPUT;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
I have not worked with a dataset with as many obs as yours, and whenever I need a cumulative value, I use retain.   &lt;BR /&gt;
&lt;BR /&gt;
The output I got has the structure:&lt;BR /&gt;
&lt;BR /&gt;
Custid    tvoid    tsmoke&lt;BR /&gt;
12001      3        9&lt;BR /&gt;
12004      2        6&lt;BR /&gt;
12005      3        8&lt;BR /&gt;
12006      2        7&lt;BR /&gt;
12007      4        12&lt;BR /&gt;
&lt;BR /&gt;
Hope this is of use to you!!&lt;BR /&gt;
&lt;BR /&gt;
Cathy</description>
      <pubDate>Fri, 06 Jun 2008 04:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23651#M1022</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T04:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23652#M1023</link>
      <description>Hi:&lt;BR /&gt;
  Proc FREQ will give you a frequency and cum frequency (as well as percent and cum percent) and if you don't like the format of the default FREQ output, you can always create an output dataset from PROC FREQ and use a different procedure to print the output dataset.&lt;BR /&gt;
&lt;BR /&gt;
  In addition to Proc TABULATE, Proc REPORT would do a count such as you want.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 06 Jun 2008 11:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23652#M1023</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-06-06T11:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23653#M1024</link>
      <description>Thanks for your help. &lt;BR /&gt;
It did helped me. But later noticed that dataset has null values, which gives the sum as null values too. So how to handle adding up values along with null values.&lt;BR /&gt;
This shld give a compleet solution.</description>
      <pubDate>Fri, 06 Jun 2008 19:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23653#M1024</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T19:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23654#M1025</link>
      <description>datasets do have some null values, so how to handle them adding up. I am really stuck up here.</description>
      <pubDate>Fri, 06 Jun 2008 19:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23654#M1025</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T19:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23655#M1026</link>
      <description>Finally got to find out the soultion of using sum(of function which considers missing values. This solved the problem.&lt;BR /&gt;
Thanks for all your helping tips.</description>
      <pubDate>Fri, 06 Jun 2008 19:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23655#M1026</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T19:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23656#M1027</link>
      <description>hai could you please write the program for you problem and post it back</description>
      <pubDate>Fri, 06 Jun 2008 20:09:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23656#M1027</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T20:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: counting values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23657#M1028</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Sorry I could not respond to you immediately.  Since all the variable values were present in the data you provided, I used the sum statement.  We face this (propogation of null values)  problem with sum statement, and thus it is safe to use sum function in case of missing values.&lt;BR /&gt;
&lt;BR /&gt;
Cathy</description>
      <pubDate>Fri, 06 Jun 2008 23:22:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/counting-values-of-variables/m-p/23657#M1028</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T23:22:25Z</dc:date>
    </item>
  </channel>
</rss>

