<?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: I need to count particular one and next all to another counts is can be done in any single step? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491619#M128973</link>
    <description>&lt;P&gt;Please post test data which describes your problem, I can only work with what you provide.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Aug 2018 13:01:34 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-08-31T13:01:34Z</dc:date>
    <item>
      <title>I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491579#M128954</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data have;
  input a $;
  cards;
  car
  bus
  jeep
  aeroplane
  maruti
run;

want:

 a    count
car   1
bus    1
other  3&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Aug 2018 10:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491579#M128954</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-08-31T10:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491582#M128957</link>
      <description>&lt;PRE&gt;proc sql;
  create table want as
  select  a,
          count(*) as count
  from    (select case when a not in ("car","bus") then "other" else a end as a from have)
  group by a;
quit;&lt;/PRE&gt;
&lt;P&gt;But this is the same as simply categorising your data beforehand into the required output:&lt;/P&gt;
&lt;PRE&gt;data have;
  length a $20;
  input a $;
  if a not in ("car","bus") then a="other";
cards;
car
bus
jeep
aeroplane
maruti
;
run;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Aug 2018 10:26:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491582#M128957</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-31T10:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491597#M128963</link>
      <description>&lt;P&gt;I have more then 10 records is any other way to do. Thanks for the response.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 11:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491597#M128963</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-08-31T11:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491601#M128966</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/174522"&gt;@rajeshalwayswel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have more then 10 records is any other way to do. Thanks for the response.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why is the number of records a problem?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 11:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491601#M128966</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-08-31T11:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491603#M128967</link>
      <description>&lt;PRE&gt;if a not in ("car","bus") then a="other";&lt;/PRE&gt;&lt;P&gt;if I use this step so I need to mention all the rest of them in the operators.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 11:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491603#M128967</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-08-31T11:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491606#M128970</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/174522"&gt;@rajeshalwayswel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;if a not in ("car","bus") then a="other";&lt;/PRE&gt;
&lt;P&gt;if I use this step so I need to mention all the rest of them in the operators.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So, after having a second look at the data you posted, you need to count the observations beginning with the third one, right?&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have end=jobDone;

   retain count;

   if _n_ &amp;lt; 3 then do;
      count = 1;
      output;
      count = 0;
   end;
   else do;
      count = count + 1;
   end;

   if jobDone then do;
      a = 'other';
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Aug 2018 12:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491606#M128970</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-08-31T12:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491619#M128973</link>
      <description>&lt;P&gt;Please post test data which describes your problem, I can only work with what you provide.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 13:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491619#M128973</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-31T13:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: I need to count particular one and next all to another counts is can be done in any single step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491628#M128976</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input a $;
  cards;
  car
  bus
  jeep
  aeroplane
  maruti
run;

proc format ;
value $fmt
 'car'='car'
 'bus'='bus'
 other='other';
run;

proc freq data=have;
table a /out=want;
format a $fmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Aug 2018 13:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-count-particular-one-and-next-all-to-another-counts-is/m-p/491628#M128976</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-08-31T13:33:02Z</dc:date>
    </item>
  </channel>
</rss>

