<?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 create a new variable by using proc means? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/556676#M9872</link>
    <description>&lt;P&gt;I don't think PROC MEANS is the tool here. Try PROC SQL and do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table calcu2 as
   select *, 
          sqrt(mean(absolute_Error)) as RSME
   from calcu1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 May 2019 06:41:13 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-05-07T06:41:13Z</dc:date>
    <item>
      <title>How to create a new variable by using proc means?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/556655#M9870</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running the below code and generate sum and mean for different variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC MEANS DATA=calcu1 mean SUM MAXDEC=2 ;
var Absolute_error Absolute_errorpercentage Square_errors correctsign;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now I want to create another variable in the same table. New variable name is RSME. And I want to square root the mean of absolute_Error value and store into RSME?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggesr&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 04:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/556655#M9870</guid>
      <dc:creator>sdhilip</dc:creator>
      <dc:date>2019-05-07T04:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable by using proc means?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/556676#M9872</link>
      <description>&lt;P&gt;I don't think PROC MEANS is the tool here. Try PROC SQL and do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table calcu2 as
   select *, 
          sqrt(mean(absolute_Error)) as RSME
   from calcu1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 May 2019 06:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/556676#M9872</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-07T06:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable by using proc means?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/556808#M9890</link>
      <description>&lt;P&gt;RMSE doesn't appear to be a calculated statistic within PROC MEANS, but CSS may help you get there along with the N.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n1qnc9bddfvhzqn105kqitnf29cp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n11nn4xu6p9wvjn1lh60wtvvn538"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n1qnc9bddfvhzqn105kqitnf29cp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n11nn4xu6p9wvjn1lh60wtvvn538&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot calculate a new variable within PROC MEANS. You'll have to either do it manually or capture the output and calculate it later.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271305"&gt;@sdhilip&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running the below code and generate sum and mean for different variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC MEANS DATA=calcu1 mean SUM MAXDEC=2 ;
var Absolute_error Absolute_errorpercentage Square_errors correctsign;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now I want to create another variable in the same table. New variable name is RSME. And I want to square root the mean of absolute_Error value and store into RSME?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please suggesr&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 15:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/556808#M9890</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-07T15:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable by using proc means?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/561007#M10525</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I calculated Sum Square Error, Sum Absolute Error, Sum Absolute percentage error by using&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=calcu1; 
       var nyse forecast std Absolute_errors Square_errors 
       Absolute_error_percentage correct_sign_perc; 
       sum Absolute_errors Square_errors Absolute_error_percentage correct_sign_perc;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output&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="Capture.JPG" style="width: 513px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29708i0C57F15C4FB59A07/image-dimensions/513x405?v=v2" width="513" height="405" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I would like to calculate the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My observation is 22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; Mean Square error&amp;nbsp; (Sum Square error / 22)&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; Mean Absolute error (Sum Absolute error / 22)&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; Mean Absolute percentage error (Sum Absolute Percentage error /22)&lt;/P&gt;&lt;P&gt;4) % correct sign _prediction - I just need to print the above 13 value in the table into 13 %.&lt;/P&gt;&lt;P&gt;5) Finally, I want to calculate = RMSE (Sq.rt(mean square error)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above items need to be stored in the same table or a different table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I would like to have the following&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="Untitled.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29710iEAA5A2BB37C77662/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have gone through all the posts but unable to find the solution. Could you please help? Either I need to have the details in a different table or in the same table&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 01:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/561007#M10525</guid>
      <dc:creator>sdhilip</dc:creator>
      <dc:date>2019-05-23T01:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new variable by using proc means?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/561035#M10529</link>
      <description>Run PROC MEANS again on the outputted data if that's what you need, you're just requesting different statistics.</description>
      <pubDate>Thu, 23 May 2019 04:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-create-a-new-variable-by-using-proc-means/m-p/561035#M10529</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-23T04:25:39Z</dc:date>
    </item>
  </channel>
</rss>

