<?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 many variables by group problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788248#M251975</link>
    <description>&lt;P&gt;It works but now i have to understand PROC STATEMENTS you have used. Thanks. (I will remember to share data &lt;span class="lia-unicode-emoji" title=":smiling_face_with_halo:"&gt;😇&lt;/span&gt;)&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jan 2022 10:55:19 GMT</pubDate>
    <dc:creator>moteku</dc:creator>
    <dc:date>2022-01-04T10:55:19Z</dc:date>
    <item>
      <title>counting many variables by group problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788246#M251973</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="problem.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67102i2E0B7936B1BC04D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="problem.png" alt="problem.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; From the table above, I would like to count number of successful and unsuccessful (failed and canceled state) kickstarter campaigns by main category.&lt;/P&gt;&lt;P&gt;I need to have table like this:&lt;/P&gt;&lt;P&gt;main_category | number_of_successful_campaigns | number_of_unsuccessful_campaigns&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x&lt;/P&gt;&lt;P&gt;I do not know how should I even start..&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 10:37:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788246#M251973</guid>
      <dc:creator>moteku</dc:creator>
      <dc:date>2022-01-04T10:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: counting many variables by group problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788247#M251974</link>
      <description>&lt;P&gt;1) Next time share some useful test data...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id main_category $ state $;
cards;
1 X successful
2 Y successful
3 X failed
4 Y failed
5 X failed
6 X failed
7 Y successful
8 Y successful
;
run;
proc print;
run;

proc tabulate data = have out = want;
  class main_category state;
  table main_category, state*N;
run;

proc transpose data = want out = want(drop=_name_) prefix=number_of_ suffix=_campaigns;
  by main_category;
  id state;
  var N;
run;

proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 10:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788247#M251974</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-01-04T10:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: counting many variables by group problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788248#M251975</link>
      <description>&lt;P&gt;It works but now i have to understand PROC STATEMENTS you have used. Thanks. (I will remember to share data &lt;span class="lia-unicode-emoji" title=":smiling_face_with_halo:"&gt;😇&lt;/span&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 10:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788248#M251975</guid>
      <dc:creator>moteku</dc:creator>
      <dc:date>2022-01-04T10:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: counting many variables by group problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788249#M251976</link>
      <description>&lt;P&gt;1) Proc tabulate works as Excel's Pivot. it is just to aggregate data, you could use Proc SQL, for that job too.&lt;/P&gt;
&lt;P&gt;2) Proc transpose is just for "reshaping" dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B-)&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 11:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788249#M251976</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-01-04T11:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: counting many variables by group problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788250#M251977</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
     tables main_category*state;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to combine failed and cancelled, you can do that with custom formats, or in a DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, please provide example data in a usable form, as a SAS data step (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;instructions&lt;/A&gt;). Data in a screen capture is not usable.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 11:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-many-variables-by-group-problem/m-p/788250#M251977</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-04T11:23:03Z</dc:date>
    </item>
  </channel>
</rss>

