<?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 to calculate percentage of each group in SAS? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629444#M30217</link>
    <description>&lt;P&gt;I cannot work with data in a screen capture. The specific request was "&lt;SPAN&gt;Please provide a portion of your data &lt;STRONG&gt;as a SAS DATA step&lt;/STRONG&gt;." Here are Instructions:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;How to create a data step version of your data AKA generate sample data for forums&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the EXACT calculation you want to do with this data? Your PROC SQL code does not compute percents, what is the numerator and what is the denominator of the percent that you want?&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 14:51:31 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-03-04T14:51:31Z</dc:date>
    <item>
      <title>How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629370#M30213</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'd like to ask u guys some questions related to SAS statistical method. (SQL, any code,,)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I want to see is the percentage of food sales on a daily basis based on the data attached.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer to information below to understand the attached file. I want to compare these three groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Excel Sheet1]&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1) Number of foods sold for same period with the intervention date of last year (Nov,19th 2018 ~ Dec, 14th 2018 / 4 weeks exclude Sat &amp;amp; Sun) - No&amp;nbsp;&lt;/SPAN&gt;intervention&lt;/P&gt;&lt;P&gt;2) Number of food sales before the intervention (Oct, 25th 2019 ~ Nov, 15th 2019 /&amp;nbsp;&lt;SPAN&gt;4 weeks exclude Sat &amp;amp; Sun) - No intervention&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3) Number of food sales during the intervention (Nov,18th 2019 ~ Dec, 13th 2019 / 4 weeks exclude Sat &amp;amp; Sun) - Intervention&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Background]&lt;BR /&gt;&lt;SPAN&gt;I classifie&lt;/SPAN&gt;d all foods in school cafeteria as nutrition score and put Alphabet score stickers on them during the intervention time. (A,B,C,D,E - A has the best nutrition composition).&amp;nbsp;&lt;SPAN&gt;And I want to know how these nutri-score stickers affect people's consumption habit. &lt;/SPAN&gt;&lt;SPAN&gt;I want to do interrupted time series analysis ultimately, but I want to see the ratio of each group before that.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will be much appreciated if u guys let me know how to solve this problem. This is for my thesis.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please feel free to comment on me if u have questions.&amp;nbsp;&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="fdfcd.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36572i52F0A26CDBE79B0A/image-size/small?v=v2&amp;amp;px=200" role="button" title="fdfcd.png" alt="fdfcd.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scores@1_5x.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36574i76A250AABDCC885B/image-size/small?v=v2&amp;amp;px=200" role="button" title="scores@1_5x.png" alt="scores@1_5x.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dddd.JPG" style="width: 274px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36573iAB45A03DBAF7A095/image-dimensions/274x336?v=v2" width="274" height="336" role="button" title="dddd.JPG" alt="dddd.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1,2) Caculation system Nutri-Score&lt;/P&gt;&lt;P&gt;3) my key thesis' graph in harvard Univ.&lt;/P&gt;&lt;P&gt;(&lt;A href="https://search.proquest.com/docview/1820592544?rfr_id=info%3Axri%2Fsid%3Aprimo" target="_blank"&gt;https://search.proquest.com/docview/1820592544?rfr_id=info%3Axri%2Fsid%3Aprimo&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 08:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629370#M30213</guid>
      <dc:creator>chiyoung</dc:creator>
      <dc:date>2020-03-04T08:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629395#M30214</link>
      <description>&lt;P&gt;Most of us will not download Excel files (or other Microsoft Office files) because they are a security risk.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide a portion of your data as a SAS DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC FREQ calculates percentages of each group.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 11:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629395#M30214</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-04T11:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629428#M30215</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table posco1 as&lt;BR /&gt;select *, sum(ea) as sum_ea&lt;BR /&gt;from posco&lt;BR /&gt;group by grade,day&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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-center" image-alt="ddddddccc.JPG" style="width: 301px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36583i1F4A763D90049B2B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ddddddccc.JPG" alt="ddddddccc.JPG" /&gt;&lt;/span&gt;&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-center" image-alt="fdfasdfsasdfsa.JPG" style="width: 324px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36584i3EAFC7F11FF0D2AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fdfasdfsasdfsa.JPG" alt="fdfasdfsasdfsa.JPG" /&gt;&lt;/span&gt;&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-center" image-alt="gfdsgsdfgsfg.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36585i3D4352131A91ECE2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gfdsgsdfgsfg.JPG" alt="gfdsgsdfgsfg.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 14:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629428#M30215</guid>
      <dc:creator>chiyoung</dc:creator>
      <dc:date>2020-03-04T14:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629444#M30217</link>
      <description>&lt;P&gt;I cannot work with data in a screen capture. The specific request was "&lt;SPAN&gt;Please provide a portion of your data &lt;STRONG&gt;as a SAS DATA step&lt;/STRONG&gt;." Here are Instructions:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;How to create a data step version of your data AKA generate sample data for forums&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the EXACT calculation you want to do with this data? Your PROC SQL code does not compute percents, what is the numerator and what is the denominator of the percent that you want?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 14:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629444#M30217</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-04T14:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629512#M30220</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table posco1 as
select *, sum(ea) as sum_ea
from posco
group by grade,day 
;

proc sort data = posco1 out = posco2 nodupkey;
by grade sum_ea;
run;


proc sql;
create table posco2 as
select *, sum_ea / sum(sum_ea) * 100 as percent
from posco1
group by day
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made this mistake because I wasn't used to it.&lt;BR /&gt;I'm so sorry to bother you.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629512#M30220</guid>
      <dc:creator>chiyoung</dc:creator>
      <dc:date>2020-03-04T17:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629514#M30221</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.POSCO;
  infile datalines dsd truncover;
  input day:DATE9. grade:$2. ea:32.;
  format day DATE9.;
  label day="day" grade="grade" ea="ea";
datalines;
19NOV2018 a 5
19NOV2018 a 38
19NOV2018 a 4
19NOV2018 a 10
19NOV2018 a 6
19NOV2018 a 30
19NOV2018 a 0
19NOV2018 a 5
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I made this mistake because I wasn't used to it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm so sorry to bother you.&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629514#M30221</guid>
      <dc:creator>chiyoung</dc:creator>
      <dc:date>2020-03-04T17:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629516#M30222</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/314978"&gt;@chiyoung&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table posco1 as
select *, sum(ea) as sum_ea
from posco
group by grade,day 
;

proc sort data = posco1 out = posco2 nodupkey;
by grade sum_ea;
run;


proc sql;
create table posco2 as
select *, sum_ea / sum(sum_ea) * 100 as percent
from posco1
group by day
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;SPAN&gt;Also, I am calculating each ratio in this way.&lt;/SPAN&gt;&lt;/CODE&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It seems as if you have answered your own question. Or am I misunderstanding something?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629516#M30222</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-04T17:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate percentage of each group in SAS?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629521#M30223</link>
      <description>&lt;P&gt;Given what you've posted, consider PROC FREQ.&lt;/P&gt;
&lt;P&gt;It calculates the percentages automatically. So what you need to figure out is how to filter your data set but the percentage part is trivial. If you cannot provide real data that's understandable, instead generalize your problem and consider using datasets from SASHELP library, which are available to all SAS users instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=sashelp.cars;
table origin;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/314978"&gt;@chiyoung&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I'd like to ask u guys some questions related to SAS statistical method. (SQL, any code,,)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What I want to see is the percentage of food sales on a daily basis based on the data attached.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to information below to understand the attached file. I want to compare these three groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Excel Sheet1]&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1) Number of foods sold for same period with the intervention date of last year (Nov,19th 2018 ~ Dec, 14th 2018 / 4 weeks exclude Sat &amp;amp; Sun) - No&amp;nbsp;&lt;/SPAN&gt;intervention&lt;/P&gt;
&lt;P&gt;2) Number of food sales before the intervention (Oct, 25th 2019 ~ Nov, 15th 2019 /&amp;nbsp;&lt;SPAN&gt;4 weeks exclude Sat &amp;amp; Sun) - No intervention&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3) Number of food sales during the intervention (Nov,18th 2019 ~ Dec, 13th 2019 / 4 weeks exclude Sat &amp;amp; Sun) - Intervention&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Background]&lt;BR /&gt;&lt;SPAN&gt;I classifie&lt;/SPAN&gt;d all foods in school cafeteria as nutrition score and put Alphabet score stickers on them during the intervention time. (A,B,C,D,E - A has the best nutrition composition).&amp;nbsp;&lt;SPAN&gt;And I want to know how these nutri-score stickers affect people's consumption habit. &lt;/SPAN&gt;&lt;SPAN&gt;I want to do interrupted time series analysis ultimately, but I want to see the ratio of each group before that.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will be much appreciated if u guys let me know how to solve this problem. This is for my thesis.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please feel free to comment on me if u have questions.&amp;nbsp;&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="fdfcd.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36572i52F0A26CDBE79B0A/image-size/small?v=v2&amp;amp;px=200" role="button" title="fdfcd.png" alt="fdfcd.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scores@1_5x.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36574i76A250AABDCC885B/image-size/small?v=v2&amp;amp;px=200" role="button" title="scores@1_5x.png" alt="scores@1_5x.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dddd.JPG" style="width: 274px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36573iAB45A03DBAF7A095/image-dimensions/274x336?v=v2" width="274" height="336" role="button" title="dddd.JPG" alt="dddd.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;1,2) Caculation system Nutri-Score&lt;/P&gt;
&lt;P&gt;3) my key thesis' graph in harvard Univ.&lt;/P&gt;
&lt;P&gt;(&lt;A href="https://search.proquest.com/docview/1820592544?rfr_id=info%3Axri%2Fsid%3Aprimo" target="_blank" rel="noopener"&gt;https://search.proquest.com/docview/1820592544?rfr_id=info%3Axri%2Fsid%3Aprimo&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 18:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-percentage-of-each-group-in-SAS/m-p/629521#M30223</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-04T18:06:42Z</dc:date>
    </item>
  </channel>
</rss>

