<?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: need some help with average calculations in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330040#M1827</link>
    <description>&lt;P&gt;Perhaps&amp;nbsp;there are other ways, but you could perhaps make use of a neat feature in SAS SQL, remerge statistics with&amp;nbsp;original data. Try&amp;nbsp;something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, GPA - mean(GPA) as AdjustedGPA 
from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 05 Feb 2017 19:54:34 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2017-02-05T19:54:34Z</dc:date>
    <item>
      <title>need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330036#M1825</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Need some help with some average. the question that i have is:&lt;/P&gt;&lt;P&gt;Creating new variable eg AdjustedGPA from a dataset that has GPA in the file minus the average GPA for the whole dataset. I tried the mean function by&lt;/P&gt;&lt;P&gt;proc means data=exam.Students;&lt;BR /&gt;var GPA;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I also tried sum&lt;/P&gt;&lt;P&gt;DATA students; set students1;&lt;BR /&gt;AveGPA = sum(GPA);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;it gave the same results for the average and the gpa.&lt;/P&gt;&lt;P&gt;I also need to calculate the adjusted GPA for the whole dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so how do i do it. i use sas for acedemics.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 18:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330036#M1825</guid>
      <dc:creator>mp50</dc:creator>
      <dc:date>2017-02-05T18:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330038#M1826</link>
      <description>&lt;P&gt;Try it as two steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=exam.students;&lt;/P&gt;
&lt;P&gt;var GPA;&lt;/P&gt;
&lt;P&gt;output out=means (keep=AveGPA) mean=AveGPA;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;if _n_=1 then set means;&lt;/P&gt;
&lt;P&gt;set exam.students;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gets you the average GPA on every observation in EXAM.STUDENTS.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 19:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330038#M1826</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-05T19:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330040#M1827</link>
      <description>&lt;P&gt;Perhaps&amp;nbsp;there are other ways, but you could perhaps make use of a neat feature in SAS SQL, remerge statistics with&amp;nbsp;original data. Try&amp;nbsp;something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, GPA - mean(GPA) as AdjustedGPA 
from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Feb 2017 19:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330040#M1827</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-02-05T19:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330041#M1828</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;I like your sql suggestion but i need to stick to sas studio as that is what my school wants. however, i tried the previous suggestion and i was able to get an average GPA for the whole dataset. the purpose of the average GPA was to calculate the adjusted GPA. so the adjusted gpa should be the gpa that is reported in the file minus the average gpa. i still havent figured the last part. so please help me.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 20:13:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330041#M1828</guid>
      <dc:creator>mp50</dc:creator>
      <dc:date>2017-02-05T20:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330064#M1829</link>
      <description>&lt;P&gt;Do you mean you need to know how to add this to the final DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AdjustedGPA = GPA - AveGPA;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also consider an alternative:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AdjustedGPA = GPA / AveGPA;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might be easier to work with values that are always positive instead of a mix of positive and negative ... depends on the analysis you are planning.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 23:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330064#M1829</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-05T23:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330066#M1830</link>
      <description>&lt;P&gt;I tried this but its giving "." in all GPA, AveGPA and AdjustedGPA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data exam.students;&lt;BR /&gt;set exam.students1;&lt;BR /&gt;adjustedGPA= AveGPA-GPA;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I need to have all three variables in the dataset students. and i am not sure how to work with values. i am really new at this so i am lost. i do appreciate your help and guidance.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 23:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330066#M1830</guid>
      <dc:creator>mp50</dc:creator>
      <dc:date>2017-02-05T23:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330067#M1831</link>
      <description>&lt;P&gt;This means the original construction of your data set is faulty. &amp;nbsp;All the GPA values are missing. &amp;nbsp;You'll have to go back to the step that created the data set in the first place.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 23:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330067#M1831</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-05T23:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330068#M1832</link>
      <description>&lt;P&gt;Sorry mistake. It was good until i did this step&lt;/P&gt;&lt;P&gt;data exam.students;&lt;BR /&gt;set exam.students1;&lt;BR /&gt;adjustedGPA= AveGPA-GPA;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;after that step, the adjustedgpa and avegpa are showing "."&lt;/P&gt;&lt;P&gt;so where do you think i have gone wrong. as you suggested before it could be the negative values but i am not sure how to calculate the adjusted gpa otherwise. I also tried the GPA/AveGPA and still there are dots. so how do i calculate with values&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2017 23:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330068#M1832</guid>
      <dc:creator>mp50</dc:creator>
      <dc:date>2017-02-05T23:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: need some help with average calculations</title>
      <link>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330074#M1833</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;I figured the adjusted&amp;nbsp;GPA. it was really traumatic but got it in the end. I thank you and the other poster for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 01:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/need-some-help-with-average-calculations/m-p/330074#M1833</guid>
      <dc:creator>mp50</dc:creator>
      <dc:date>2017-02-06T01:27:35Z</dc:date>
    </item>
  </channel>
</rss>

