<?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: How do I count values within a variable multiple ways for a summary table in SAS EG? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480850#M31202</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;infile cards dlm=',';&lt;BR /&gt;input program $id :$12. status $ gender $;&lt;BR /&gt;cards;&lt;BR /&gt;a,jk20020,ft24,m&lt;BR /&gt;a,rm5050,ft24,f&lt;BR /&gt;a,rn1010,ft30,m&lt;BR /&gt;a,nr80080,ft30,f&lt;BR /&gt;a,ab10010,pt12,m&lt;BR /&gt;a,zu99000,pt12,f&lt;BR /&gt;a,xx44100,pt12,f&lt;BR /&gt;a,be55333,pt15,m&lt;BR /&gt;a,qp22734,pt15,m&lt;BR /&gt;b,uv19356,ft24,f&lt;BR /&gt;b,pq34224,ft24,m&lt;BR /&gt;b,qz11222,ft30,f&lt;BR /&gt;b,ww44120,ft30,m&lt;BR /&gt;b,qq99018,ft30,f&lt;BR /&gt;b,rt33201,pt15,f&lt;BR /&gt;b,ww99222,pt15,f&lt;BR /&gt;b,zl5213,pt15,f&lt;BR /&gt;;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select program, sum(status in ('ft24','ft30')) as ft24,sum(status='ft30') as ft30,sum(status in ('pt12','pt15')) as pt12,sum(status='pt15') as pt15,&lt;STRONG&gt;sum(gender='m') as m_count, sum(gender='f') as f_count&lt;/STRONG&gt;&lt;BR /&gt;from have&lt;BR /&gt;group by program;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jul 2018 16:35:32 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-07-24T16:35:32Z</dc:date>
    <item>
      <title>How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480829#M31197</link>
      <description>&lt;P&gt;I have a set of data in SAS EG and would like to count certain values in two different columns when a certain condition is met. I'm not sure how SAS EG wizards can assist with this or if it would require code to be entered to generate the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the output table I would like to count the "status" value in multiple columns&amp;nbsp;(see Original data and Desired table below).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like the data to be summarized as follows by program:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If the status is ft24 OR ft30 I would like to count it in the table column I've titled ft24+&lt;/LI&gt;&lt;LI&gt;If the status is ft30 I would like for it to be counted in the column I've titled ft30+&lt;/LI&gt;&lt;LI&gt;If the status is pt12 OR pt15 I would like to count it in the table column I've titled pt12+&lt;/LI&gt;&lt;LI&gt;If the status is pt15 I would like for it to be counted in the column I've titled pt15+&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original data&lt;BR /&gt;program,id,status,gender&lt;BR /&gt;a,jk20020,ft24,m&lt;BR /&gt;a,rm5050,ft24,f&lt;BR /&gt;a,rn1010,ft30,m&lt;BR /&gt;a,nr80080,ft30,f&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a,ab10010,pt12,m&lt;BR /&gt;a,zu99000,pt12,f&lt;BR /&gt;a,xx44100,pt12,f&lt;BR /&gt;a,be55333,pt15,m&lt;BR /&gt;a,qp22734,pt15,m&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b,uv19356,ft24,f&lt;BR /&gt;b,pq34224,ft24,m&lt;BR /&gt;b,qz11222,ft30,f&lt;BR /&gt;b,ww44120,ft30,m&lt;BR /&gt;b,qq99018,ft30,f&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b,rt33201,pt15,f&lt;BR /&gt;b,ww99222,pt15,f&lt;BR /&gt;b,zl5213,pt15,f&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired output in table format&lt;BR /&gt;program ft24+ ft30+ pt12+ pt15+&lt;BR /&gt;a 4 2 5 2&lt;BR /&gt;b 5 3 3 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insight and guidance is much appreciated by this SAS newbie!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480829#M31197</guid>
      <dc:creator>runningjay</dc:creator>
      <dc:date>2018-07-24T15:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480833#M31198</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dlm=',';
input program $id :$12. status $ gender $;
cards;
a,jk20020,ft24,m
a,rm5050,ft24,f
a,rn1010,ft30,m
a,nr80080,ft30,f
a,ab10010,pt12,m
a,zu99000,pt12,f
a,xx44100,pt12,f
a,be55333,pt15,m
a,qp22734,pt15,m
b,uv19356,ft24,f
b,pq34224,ft24,m
b,qz11222,ft30,f
b,ww44120,ft30,m
b,qq99018,ft30,f
b,rt33201,pt15,f
b,ww99222,pt15,f
b,zl5213,pt15,f
;
proc sql;
create table want as
select program, sum(status in ('ft24','ft30')) as ft24,sum(status='ft30') as ft30,sum(status in ('pt12','pt15')) as pt12,sum(status='pt15') as pt15
from have
group by program;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480833#M31198</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-24T15:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480844#M31199</link>
      <description>&lt;P&gt;Another really good option is that SAS has a facility called "multi-label formats", where a value can have more than one label assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, I don't think you can create one using the EG tasks to create a format, but if you run this code:&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $Statf (multilabel)
"ft24" = "ft24+"
"ft30" = "ft24+"
"ft30" = "ft30+"
"pt12" = "pt12+"
"pt15" = "pt12+"
"pt15" = "pt15+"
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then assign the format to your variable, you can get your desired results in the "Summary Tables" task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the "Data" tab of your summary table setup, with the status variable selected, change "Multi-label formats" from Disabled to Enabled. When you create your table, "ft30" should be included in both "ft24+" and "ft30+".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480844#M31199</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-07-24T15:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480847#M31200</link>
      <description>&lt;P&gt;If I wanted to continue to group by program but also include the gender variable by column output how could this code be adjusted to accomplish that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example if I wanted the same results, but I wanted it to look like this (either with gender concatenated into the column name or with gender falling under each category):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;program ft24m ft24f ft30m ft30f pt12m pt12f pt15m pt15f&lt;/P&gt;&lt;P&gt;a&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;#&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#&lt;/P&gt;&lt;P&gt;b&lt;SPAN&gt;&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;#&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;program ft24+ ft30+ pt12+ pt15+&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m f&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;m f&amp;nbsp; &amp;nbsp;&amp;nbsp;m f&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;m f&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;a&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;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;b&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;# #&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 16:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480847#M31200</guid>
      <dc:creator>runningjay</dc:creator>
      <dc:date>2018-07-24T16:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480848#M31201</link>
      <description>&lt;P&gt;do you mean&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;group by program gender;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;depends upon what you want in your results&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: do you mean count of gender: m and f?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 16:32:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480848#M31201</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-24T16:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480850#M31202</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;infile cards dlm=',';&lt;BR /&gt;input program $id :$12. status $ gender $;&lt;BR /&gt;cards;&lt;BR /&gt;a,jk20020,ft24,m&lt;BR /&gt;a,rm5050,ft24,f&lt;BR /&gt;a,rn1010,ft30,m&lt;BR /&gt;a,nr80080,ft30,f&lt;BR /&gt;a,ab10010,pt12,m&lt;BR /&gt;a,zu99000,pt12,f&lt;BR /&gt;a,xx44100,pt12,f&lt;BR /&gt;a,be55333,pt15,m&lt;BR /&gt;a,qp22734,pt15,m&lt;BR /&gt;b,uv19356,ft24,f&lt;BR /&gt;b,pq34224,ft24,m&lt;BR /&gt;b,qz11222,ft30,f&lt;BR /&gt;b,ww44120,ft30,m&lt;BR /&gt;b,qq99018,ft30,f&lt;BR /&gt;b,rt33201,pt15,f&lt;BR /&gt;b,ww99222,pt15,f&lt;BR /&gt;b,zl5213,pt15,f&lt;BR /&gt;;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select program, sum(status in ('ft24','ft30')) as ft24,sum(status='ft30') as ft30,sum(status in ('pt12','pt15')) as pt12,sum(status='pt15') as pt15,&lt;STRONG&gt;sum(gender='m') as m_count, sum(gender='f') as f_count&lt;/STRONG&gt;&lt;BR /&gt;from have&lt;BR /&gt;group by program;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 16:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480850#M31202</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-24T16:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480854#M31203</link>
      <description>&lt;P&gt;In your Summary Tables step, just drag gender under the status variable in the design window, as shown at the left. The results will be as shown on the right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EGPic.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21974iE91AC736FD5AA9F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="EGPic.png" alt="EGPic.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 16:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480854#M31203</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-07-24T16:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count values within a variable multiple ways for a summary table in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480856#M31204</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15142"&gt;@TomKari&lt;/a&gt;&amp;nbsp;simply awesome.&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88036"&gt;@runningjay&lt;/a&gt;&amp;nbsp;You should switch to Tom's solution. That seems eloquent and neat. If you do so, make sure you switch the credit to him as well. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 16:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-count-values-within-a-variable-multiple-ways-for-a/m-p/480856#M31204</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-24T16:59:18Z</dc:date>
    </item>
  </channel>
</rss>

