<?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: selecting categories of a variable for which count of category of another variables is greater t in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/455384#M284194</link>
    <description>&lt;P&gt;That's what my code did. And if it's over 50% that's the area's you wanted.&lt;/P&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/196926"&gt;@runn&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;what if I want to calculate % of smoker =1 for each zip code How should I code for the same data:&lt;/P&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;TABLE cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;smoke&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;zipCODE&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;N&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;60&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;40&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;11&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;77&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want:&lt;/P&gt;
&lt;P&gt;Zipcode %smoker&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(40/60)*100=66.67%&lt;/P&gt;
&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7%&lt;/P&gt;
&lt;P&gt;and so on for the rest of the observations in the data.&lt;/P&gt;
&lt;P&gt;how should I code?&lt;/P&gt;
&lt;P&gt;thanking you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Runn&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Apr 2018 20:02:01 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-04-18T20:02:01Z</dc:date>
    <item>
      <title>selecting categories of a variable for which count of category of another variables is greater than</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454466#M284184</link>
      <description>&lt;P&gt;Data:&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;smoke&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;zipCODE&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;N&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;60&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;40&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;11&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;77&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I want to identify zipcodes for which smoke 1 count N &amp;gt; smoke 0 count N. So from above: for zip code 7, smoke 1=77 which is greater than smoke 0=11. Therefore I'll select zip code 7 in output &amp;nbsp;but not other zip codes.&lt;/P&gt;&lt;P&gt;I want to know SAS code to get output like this from the above data:&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Zipcode&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;note: I have to do this for hundred of observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;runn.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 15:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454466#M284184</guid>
      <dc:creator>runn</dc:creator>
      <dc:date>2018-04-16T15:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454473#M284185</link>
      <description>&lt;P&gt;What happens in the other case, or if there isn't one?&amp;nbsp; Anyways:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as
  select  a.*
  from    (select * from have where smoke=1) a
  left join (select * from have where smoke=0) b
  on        a.zipcode=b.zipcode
  having a.n &amp;gt; b.n;
quit;&lt;/PRE&gt;
&lt;P&gt;Or you could proc transpose them:&lt;/P&gt;
&lt;PRE&gt;proc sort data=have;
  by zip_code smoke;
run;
proc transpose data=have out=want prefix=smoke;
  by zip_code;
  var n;
  id smoke;
run;
data want;
  set want;
  where smoke1 &amp;gt; smoke0;
run;&lt;/PRE&gt;
&lt;P&gt;Or even a diff;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if lag(zip_code)=zip_code and diff(smoke)&amp;gt;0;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Note, not tested, provide test data in the form of a datastep.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 15:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454473#M284185</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-16T15:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454480#M284186</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some basic algebra comes in handy here. I'll leave the math to you, but I think that if the mean value of smoke is greater than 50% it means that the Sum(1)&amp;gt;Sum(0).&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select zipcode, mean(smoke) as pct_smoke
from have
group by zipcode
having pct_smoke &amp;gt; 0.5;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Apr 2018 15:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454480#M284186</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-16T15:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454492#M284187</link>
      <description>&lt;P&gt;Assuming your data is in order by ZIPCODE, a DATA step can handle this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by zipcode;&lt;/P&gt;
&lt;P&gt;if first.zipcode then total=0;&lt;/P&gt;
&lt;P&gt;total + N * (smoke -&amp;nbsp;(smoke=0));&lt;/P&gt;
&lt;P&gt;if last.zipcode and total &amp;gt; 0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 15:52:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454492#M284187</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-16T15:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454500#M284188</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input smoke	zipCODE	N;
datalines;
0	1	60
1	1	40
0	5	7
0	7	11
1	7	77
;

proc sql;
create table want as
select *
from have
group by zipcode
having max(n)=n and smoke=1;
quit;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Apr 2018 16:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454500#M284188</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-16T16:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454730#M284189</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input smoke	zipCODE	N;
datalines;
0	1	60
1	1	40
0	5	7
0	7	11
1	7	77
;
data want;
 set have;
 if zipCODE=lag(zipCODE) and n&amp;gt;lag(n);
 keep zipCODE;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Apr 2018 13:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/454730#M284189</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-17T13:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/455349#M284190</link>
      <description>&lt;P&gt;what if I want to calculate % of smoker =1 for each zip code How should I code for the same data:&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;smoke&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;zipCODE&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;N&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;60&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;40&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;11&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;77&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want:&lt;/P&gt;&lt;P&gt;Zipcode %smoker&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(40/60)*100=66.67%&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7%&lt;/P&gt;&lt;P&gt;and so on for the rest of the observations in the data.&lt;/P&gt;&lt;P&gt;how should I code?&lt;/P&gt;&lt;P&gt;thanking you&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Runn&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 18:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/455349#M284190</guid>
      <dc:creator>runn</dc:creator>
      <dc:date>2018-04-18T18:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/455365#M284193</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input smoke	zipCODE	N;
datalines;
0	1	60
1	1	40
0	5	7
0	7	11
1	7	77
;
proc sql;
create table want as
select zipcode,max(case when smoke = 1 then n end)/max(case when smoke = 0 then n end )  as pct
from have
group by zipcode;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Apr 2018 19:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/455365#M284193</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-18T19:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/455384#M284194</link>
      <description>&lt;P&gt;That's what my code did. And if it's over 50% that's the area's you wanted.&lt;/P&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/196926"&gt;@runn&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;what if I want to calculate % of smoker =1 for each zip code How should I code for the same data:&lt;/P&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;TABLE cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;smoke&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;zipCODE&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;N&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;60&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;40&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;11&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;77&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want:&lt;/P&gt;
&lt;P&gt;Zipcode %smoker&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(40/60)*100=66.67%&lt;/P&gt;
&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;
&lt;P&gt;7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7%&lt;/P&gt;
&lt;P&gt;and so on for the rest of the observations in the data.&lt;/P&gt;
&lt;P&gt;how should I code?&lt;/P&gt;
&lt;P&gt;thanking you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Runn&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 20:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/455384#M284194</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-18T20:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/456691#M284195</link>
      <description>&lt;P&gt;I think this is close to solution but It's not giving me the desired outcome. The newly created want have zero observations even on imputing correct have&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 20:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/456691#M284195</guid>
      <dc:creator>runn</dc:creator>
      <dc:date>2018-04-23T20:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: selecting categories of a variable for which count of category of another variables is greater t</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/456692#M284196</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/196926"&gt;@runn&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I think this is close to solution but It's not giving me the desired outcome. The newly created want have zero observations even on imputing correct have&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No idea what that means. You want the percent of 1, in mathematical terms that's the SUM(N=1)/ Sum (N=1) + SUM(N=0) =&amp;gt; using some math that works out to the same average value of 0/1. Make sure to remove the HAVING clause which filters out the results to include only percentages greater than 50, which was your original question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also use a plain proc means and the average would be the percentage as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 20:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-categories-of-a-variable-for-which-count-of-category/m-p/456692#M284196</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-23T20:53:14Z</dc:date>
    </item>
  </channel>
</rss>

