<?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 count function in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/count-function-in-data-step/m-p/551771#M153341</link>
    <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;i'm new to sas so apologies if this is really easy but i want to total up the fields which have a condition in and those that have a blank in the field.&amp;nbsp; I have 4 conditions so a way to work out the total for condition 1 with/without something in field, then condition 2, condition 3 etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that makes sense&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code i have so far is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rsubmit &amp;amp;UNIX;&lt;BR /&gt;data pol_trv_dims;&lt;BR /&gt;set DLItm.pol_trv_dims&lt;BR /&gt;(keep = POLKEY CONDITION1 CONDITION2 CONDITION3 CONDITION4);&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;endrsubmit;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2019 15:22:57 GMT</pubDate>
    <dc:creator>Ross1010</dc:creator>
    <dc:date>2019-04-17T15:22:57Z</dc:date>
    <item>
      <title>count function in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-in-data-step/m-p/551771#M153341</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;i'm new to sas so apologies if this is really easy but i want to total up the fields which have a condition in and those that have a blank in the field.&amp;nbsp; I have 4 conditions so a way to work out the total for condition 1 with/without something in field, then condition 2, condition 3 etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that makes sense&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code i have so far is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rsubmit &amp;amp;UNIX;&lt;BR /&gt;data pol_trv_dims;&lt;BR /&gt;set DLItm.pol_trv_dims&lt;BR /&gt;(keep = POLKEY CONDITION1 CONDITION2 CONDITION3 CONDITION4);&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;endrsubmit;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 15:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-in-data-step/m-p/551771#M153341</guid>
      <dc:creator>Ross1010</dc:creator>
      <dc:date>2019-04-17T15:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: count function in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-in-data-step/m-p/551785#M153347</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271029"&gt;@Ross1010&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;hi&lt;/P&gt;
&lt;P&gt;i'm new to sas so apologies if this is really easy but i want to total up the fields which have a condition in and those that have a blank in the field.&amp;nbsp; I have 4 conditions so a way to work out the total for condition 1 with/without something in field, then condition 2, condition 3 etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that makes sense&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code i have so far is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;rsubmit &amp;amp;UNIX;&lt;BR /&gt;data pol_trv_dims;&lt;BR /&gt;set DLItm.pol_trv_dims&lt;BR /&gt;(keep = POLKEY CONDITION1 CONDITION2 CONDITION3 CONDITION4);&lt;/P&gt;
&lt;P&gt;run;&lt;BR /&gt;endrsubmit;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It really helps to show some actual example input data and what the end result should be. Provide some records that will exercise each of your rules.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to try:&lt;/P&gt;
&lt;PRE&gt;proc summary data=pol_trv_dims;
   class condition1 - condition4 /missing;
   output out=work.summary;
run;&lt;/PRE&gt;
&lt;P&gt;The output data set will have combinations of the variables on the class statement, including one record for "missing", and a count of records in the variable _freq_. There will be another variable _type_ that indicates which set of combinations each record represents,&lt;/P&gt;
&lt;P&gt;Type=0 will a total count of records, type=1 will be the summary for one variable only, expect the last one on the CLASS statement, 2, 3 and 4 would be each of the other variables on the class statement alone, higher numbers will represent different combinations. The largest value of _type_ will be all of the variables combined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can filter the data for other use on the value of _type_ to get the records you are interested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 15:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-in-data-step/m-p/551785#M153347</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-17T15:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: count function in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-in-data-step/m-p/551818#M153365</link>
      <description>&lt;P&gt;This might be a little more than you asked for, but it should all be useful:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $missfmt ' '='Blank' other='There';
run;

proc freq data=have;
tables condition1-condition4 / missing;
tables condition1*condition2*condition3*condition4 / list missing;
format condition1-condition4 $missfmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Apr 2019 17:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-in-data-step/m-p/551818#M153365</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-17T17:51:21Z</dc:date>
    </item>
  </channel>
</rss>

