- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I am running the below code and generate sum and mean for different variables.
PROC MEANS DATA=calcu1 mean SUM MAXDEC=2 ;
var Absolute_error Absolute_errorpercentage Square_errors correctsign;
RUN;
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?
Please suggesr
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't think PROC MEANS is the tool here. Try PROC SQL and do something like this
proc sql;
create table calcu2 as
select *,
sqrt(mean(absolute_Error)) as RSME
from calcu1;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't think PROC MEANS is the tool here. Try PROC SQL and do something like this
proc sql;
create table calcu2 as
select *,
sqrt(mean(absolute_Error)) as RSME
from calcu1;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
RMSE doesn't appear to be a calculated statistic within PROC MEANS, but CSS may help you get there along with the N.
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.
@sdhilip wrote:
Hi
I am running the below code and generate sum and mean for different variables.
PROC MEANS DATA=calcu1 mean SUM MAXDEC=2 ; var Absolute_error Absolute_errorpercentage Square_errors correctsign; RUN;
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?
Please suggesr
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Reeza@PeterClemmensen
Now I calculated Sum Square Error, Sum Absolute Error, Sum Absolute percentage error by using
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;
output
Now I would like to calculate the following
My observation is 22
1) Mean Square error (Sum Square error / 22)
2) Mean Absolute error (Sum Absolute error / 22)
3) Mean Absolute percentage error (Sum Absolute Percentage error /22)
4) % correct sign _prediction - I just need to print the above 13 value in the table into 13 %.
5) Finally, I want to calculate = RMSE (Sq.rt(mean square error)
The above items need to be stored in the same table or a different table:
And I would like to have the following
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
- Tags:
- SAS programming
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content