Hello everybody,
I have to translate a 4k rows R code into SAS code. The code is not so difficult but uses a couple of packages that I ignore if are present in our current SAS licence. Our SAS licence includes the following main packages:
while the R code is using these main packages:
MLmetrics | Machine Learning Evaluation Metrics |
smbinning | Scoring Modeling and Optimal Binning |
ineq | Measuring Inequality, Concentration, and Poverty |
Information | Data Exploration with Information Theory (Weight-of-Evidence and Information Value) |
May I ask you an help to identify any possible lacks between the SAS licence and the R packages currently used?
Thanks all!
Gabriele
Just a quick comment: R packages are often used because they provide niche computations that are specialized to a subject area (such as "measuring inequality and poverty"). Those specialized computations are (by definition) unlikely to be found in a standard procedure. SAS users often use either the DATA step (for univariate computations) or SAS/IML (for multivariate computations) to implement specialized computations. I suspect you might want to use SAS/IML for some of this project.
For what it's worth, if someone hired me to "to translate a 4k rows R code into SAS code," I would ask them to define the input data and the analyses that they want to be performed. I would almost surely not try to "translate" from one language to another one line at a time, but would rewrite the program in the new language to perform the requested analyses.
Just a quick comment: R packages are often used because they provide niche computations that are specialized to a subject area (such as "measuring inequality and poverty"). Those specialized computations are (by definition) unlikely to be found in a standard procedure. SAS users often use either the DATA step (for univariate computations) or SAS/IML (for multivariate computations) to implement specialized computations. I suspect you might want to use SAS/IML for some of this project.
For what it's worth, if someone hired me to "to translate a 4k rows R code into SAS code," I would ask them to define the input data and the analyses that they want to be performed. I would almost surely not try to "translate" from one language to another one line at a time, but would rewrite the program in the new language to perform the requested analyses.
Hi Rick,
I totally agree with you. We need to translate an IFRS9 model with its risk components (PD, EAD, LGD) and the only problem is that the customer is really hurry with this activity so they will provide us only the input datasets (csv) and the R scripts. We will understand on our own the R code and the desired output (both output csv and graphs) running the scripts. I'm going to ask to customer a documentation in order to understand a bit more which kind of computations they are performing.
Thanks a lot for your kindness, I will update you soon
Gabriele
Hi Rick,
I gathered a couple of more detailed information from the client. They sent me a list of R functions currently used during the calculation. I mapped them in this way:
R packages | SAS license/procedure |
Glm() functions | proc GENMOD |
Functionality for creating plots (ggplot2 package) | SAS GRAPH |
Dplyr functions to rearrange data such as ‘mutate’, ‘filter’,’summarise’,’group_by’ | SAS BASE |
Gini() from MLmetrics | SAS BASE |
smbinning.psi(), smbinning() for obtaining optimal bucketing parameters | proc HPBIN |
step() function on a glm() outcome | SAS BASE |
create_infotables() from Information package | SAS BASE |
I suggested to take in consideration the possible add of SAS/IML package in order to speed up our porting activities. We will have an alignment with SAS.
Thanks for your kindness, have a nice day.
Gabriele
Here is a paper of mine about WOE .
https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1808-2018.pdf
And attachment is the code I used for score card.
If you don't have SAS/EM , all you need is SAS/Base and SAS/Stat , but you need write hundreds of code .
Here is SAS code about making a Credit ScoreCard.
Good Luck.
First of all thanks a lot for your help and kindness, i really appreciate it! We are working on a IFRS9 model.
As I wrote to Rick, I'm gathering further information to understand if we need the SAS/IML package that you are using too.
Take care, cheers!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.