<?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: Descriptive Statistics in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486464#M126585</link>
    <description>The average of variable score by variable weekday</description>
    <pubDate>Mon, 13 Aug 2018 20:02:46 GMT</pubDate>
    <dc:creator>Goffy123</dc:creator>
    <dc:date>2018-08-13T20:02:46Z</dc:date>
    <item>
      <title>Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486453#M126574</link>
      <description>&lt;P&gt;Compute Descriptive Statistics of score by review_weekday?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my question any help into what to do in code?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 19:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486453#M126574</guid>
      <dc:creator>Goffy123</dc:creator>
      <dc:date>2018-08-13T19:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486455#M126576</link>
      <description>&lt;P&gt;Assuming the variable is numeric you would use PROC MEANS, here's a fully worked example, copy and paste into SAS and run to see the example. If you have categorical data, it's a different process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;*Create summary statistics for a dataset by a 'grouping' variable and store it in a dataset;

*Generate sample fake data;
data have;
	input ID          feature1         feature2         feature3;
	cards;
1               7.72               5.43              4.35
1               5.54               2.25              8.22 
1               4.43               6.75              2.22
1               3.22               3.21              7.31
2               6.72               2.86              6.11
2               5.89               4.25              5.25 
2               3.43               7.30              8.21
2               1.22               3.55              6.55

;
run;

*ensure sort before means;
proc sort data=have;
by id;
run;

*Create summary data;
proc means data=have noprint;
	by id;
	var feature1-feature3;
	output out=want median= var= mean= /autoname;
run;

*Show for display;
proc print data=want;
run;

*First done here:https://communities.sas.com/t5/General-SAS-Programming/Getting-creating-new-summary-variables-longitudinal-data/m-p/347940/highlight/false#M44842;
*Another way to present data is as follows;

proc means data=have stackods nway n min max mean median std p5 p95;
    by id;
    var feature1-feature3;
    ods output summary=want2;
run;

*Show for display;
proc print data=want2;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas&lt;/A&gt;&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/226110"&gt;@Goffy123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Compute Descriptive Statistics of score by review_weekday?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my question any help into what to do in code?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 19:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486455#M126576</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-13T19:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486461#M126582</link>
      <description>I have categoric data does this mean it is a different way?</description>
      <pubDate>Mon, 13 Aug 2018 19:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486461#M126582</guid>
      <dc:creator>Goffy123</dc:creator>
      <dc:date>2018-08-13T19:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486463#M126584</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226110"&gt;@Goffy123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I have categoric data does this mean it is a different way?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What descriptive statistics do you want?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 19:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486463#M126584</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-13T19:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486464#M126585</link>
      <description>The average of variable score by variable weekday</description>
      <pubDate>Mon, 13 Aug 2018 20:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486464#M126585</guid>
      <dc:creator>Goffy123</dc:creator>
      <dc:date>2018-08-13T20:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486466#M126587</link>
      <description>&lt;P&gt;Provide more details and I can answer it then. For example, you can calculate the mean of a categorical variable so not sure how that would work, given your other response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT - added last sentence.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226110"&gt;@Goffy123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I have categoric data does this mean it is a different way?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 20:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486466#M126587</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-13T20:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486467#M126588</link>
      <description>My dataset is named Lasvegas and from that dataset I am trying to find the average of score by Review_weekday. The Score variable is 1-5 and the Review_ weekday is Monday, Tuesday.... Sunday.</description>
      <pubDate>Mon, 13 Aug 2018 20:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486467#M126588</guid>
      <dc:creator>Goffy123</dc:creator>
      <dc:date>2018-08-13T20:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486470#M126589</link>
      <description>&lt;P&gt;If your only categorical variable is the grouping variable, ie weekday, that's fine since you're not summarizing the categorical data.&lt;/P&gt;
&lt;P&gt;Did you run the example above? Did it work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can align your variables the same way and it should work fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're having issues post the code you're using and detail any issues.&amp;nbsp;&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/226110"&gt;@Goffy123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;My dataset is named Lasvegas and from that dataset I am trying to find the average of score by Review_weekday. The Score variable is 1-5 and the Review_ weekday is Monday, Tuesday.... Sunday.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 20:09:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486470#M126589</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-13T20:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptive Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486475#M126591</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select weekday, avg(score)
from have
group by weekday;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Aug 2018 20:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descriptive-Statistics/m-p/486475#M126591</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-13T20:22:22Z</dc:date>
    </item>
  </channel>
</rss>

