BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
prraj67
Calcite | Level 5

We ran linear regression on our dataset. We expect the regression node to output actual as wells as predicted values.

Now we want to calculate MAPE i.e. (actual-predicted)/actual.

Is there any options in SAS miner that would give this value?

1 ACCEPTED SOLUTION

Accepted Solutions
WendyCzika
SAS Employee

You would have to calculate this in a SAS Code node.  If you connect your Regression node to a SAS Code node, then in the SAS Code node, the data set represented by the &em_import_data macro variable contains your actual and predicted target for each obervation.  So you could do something like:

data calc_mape;
  set &em_import_data;
  mape = %EM_RESIDUAL / %EM_Target;
 run;

proc means data=calc_mape sum;
   var mape;
run;

 

View solution in original post

2 REPLIES 2
sbxkoenk
SAS Super FREQ

Hello,

mean absolute error (MAE) and mean absolute percentage error (MAPE) are not a part of standard regression output.
They are more commonly found in the output of time series forecasting (time series regression) procedures, such as the ones in SAS/ETS, SAS/HPF (Forecast Server).
MAPE is easy to compute of course but beware that the MAPE can only be computed with respect to data that are guaranteed to be strictly positive.

 

I bumped into this paper (but cannot give any guarantee about its quality):

Using the Mean Absolute Percentage Error for Regression Models (Arnaud de Myttenaere: first author).

https://www.elen.ucl.ac.be/Proceedings/esann/esannpdf/es2015-107.pdf

https://hal.archives-ouvertes.fr/hal-01162980/document

 

Koen

WendyCzika
SAS Employee

You would have to calculate this in a SAS Code node.  If you connect your Regression node to a SAS Code node, then in the SAS Code node, the data set represented by the &em_import_data macro variable contains your actual and predicted target for each obervation.  So you could do something like:

data calc_mape;
  set &em_import_data;
  mape = %EM_RESIDUAL / %EM_Target;
 run;

proc means data=calc_mape sum;
   var mape;
run;

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 8330 views
  • 0 likes
  • 3 in conversation