Calculate RMSE and MAE in R and SAS

Here is code to calculate RMSE and MAE in R and SAS. RMSE (root mean squared error), also called RMSD (root mean squared deviation), and MAE (mean absolute error) are both used to evaluate models. MAE gives equal weight to all errors, while RMSE gives extra weight to large errors.

Data about each month (SAS)

A SAS code to generate information about each month such as the number of days in the month, week days, hours, work hours, etc. using intck and intnx function. It’s also a good example of using a DATA step to generate a data set without an input data set (i.e., no SET or MERGE statements).

Dummy coding in SAS

Here is a macro to generate binary features (also called dummy coding) from a nominal variable (also called a categorical variable, such as eye color). This is also called one-hot encoding and one-of-K encoding. The automation saves time and avoids mistakes when there are many possible values to a category or the values can change.