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;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 8179 views
  • 0 likes
  • 3 in conversation