BookmarkSubscribeRSS Feed
raphaelchaves
Calcite | Level 5

Hello all,

I have tried to develop something through SAS PROC IML in order to calculate a Credit Rating Transition Matrix for a specific sample, considering the cohort and hazard rate approaches, and also some confidence levels using bootstrap. This website (https://analyticsrusers.blog/2017/08/15/use-r-to-easily-estimate-migration-matrices-with-rtransprob-...) provides some specific examples regarding the "RTransprob" package which contains a set of functions used to automate commonly used methods to estimate migration matrices used in credit risk analysis. I'd like to do the same, however, through SAS instead of R. I have a SAS dataset containing the following attributes: CustomerId,Date,Rating,RatingNum.

 

I'm sending as an attached files:

a) Input_RatingTransitionMatrix(3).txt = Text file containing the data used for calculating the transition matrices

b) Output_RatingTransitionMatrix(1).xlsx = Excel file that illustrates the final results provided by the specific R package 

 

I would be so grateful if you are able to send me a code developed in SAS in order to achieve the same/or similar results.
Thanks in advance.
Rgs,
Raphael

5 REPLIES 5
Rick_SAS
SAS Super FREQ

> I would be so grateful if you are able to send me a code developed in SAS in order to achieve the same/or similar results.

 

I suspect you will need to do some preliminary work on this problem before we will be able to offer help. Typically, the OP will post a program and ask questions about parts of the code that are confusing or not working. We can then offer advice, discuss strategies, and propose ways to modify your code.

 

Do you know how to write a transition matrix? If not, start with 

https://blogs.sas.com/content/iml/2016/07/07/markov-transition-matrices-sasiml.html

and

https://blogs.sas.com/content/iml/2016/07/13/absorbing-markov-chains-in-sas.html

There are also papers about Markov transition matrices in SAS by searching the conference proceedings at
      markov transition matrix iml site:lexjansen.com

 

 

raphaelchaves
Calcite | Level 5
Thanks Rick,
I was assuming that SAS has already had developed something like that in a specific Proc statement, given that other languages like R, Python, Matlab and etc have already implemented it easily. Said that, I think I’m gonna use what other languages have to offer, instead of trying to develop something from scratch in SAS.
Rgs,
Raphael
Rick_SAS
SAS Super FREQ

This forum is for writing SAS/IML programs, so that is why I assumed you wanted to write an IML program. SAS has a  lot of functionality for econometric, forecasting, and credit risk. I don't know all the offerings., but others who have backgrounds in forecasting might be able to point you to other SAS products.

 

I will move this thread to the Forecasting and Econometrics community. Hopefully someone there will know how to perform this functionality in SAS.

raphaelchaves
Calcite | Level 5
Hello Ricky
Actually, I have tried to write a code using the SAS/IML statement, however, I’m not envisioning to spend a huge time trying to do that. What makes me disappointed is that the attention provided in R and Python forums is much better if compared to what I received here, given that these folks provided me some very useful examples from scratch, step-by-step, in order to achieve what I’m looking for, however, using R and Python and not SAS.
Rgs,
sbxkoenk
SAS Super FREQ

Hello @raphaelchaves ,

 

In general you get very good (high quality) code examples in this communities site (and certainly from Rick), but you have to give a bit of a lead. Especially when there are so much methods and approaches to achieve "the same". 


It is also quite a complex thing (although that is relative of course). Correcting code is then easier than coughing it up from scratch (I do not know if the latter sentence is proper English 🙄).


I'm not in finance consulting anymore (I was a lot before 2010 for Basel II) but I'm as good as sure the SAS solutions for Risk Management and Risk and Finance Analytics have built-in credit migration transition matrices. Maybe you can contact your local SAS office to find out.

 

Also have a look at the SSM procedure (for State Space Models ) in SAS/ETS. I think it should be able to do what you're looking for.

 

Kind regards,

Koen

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1913 views
  • 0 likes
  • 3 in conversation