New Contributor
Posts: 2

# Create probability default from raw data

Dear All,

As a begginer user to SAS, I was wondering if you could please help me in the following question.

I have a raw data of S&P rating for one year horizon(beginning rating and ending rating) for 15,085 companies. I was wondering how can I calculate the probability of default (PD) from this data and later on do some other procedure such as confidence interval for the probability of defaults in SAS?

I greatly appreciate any help and comment.

Super User
Posts: 23,346

## Re: Create probability default from raw data

Your question is vague. Can you expand on your question please? Are you aiming for a predictive model or empirical calculation?

New Contributor
Posts: 2

## Re: Create probability default from raw data

Hi Reeza thanks for replying back to my post,

my goal is to use non-parametric bootstrap to generate 95% confidence intervals for default rates for each rating category.

First of all, I believe that I have to generate default rates in my raw data, but I am not sure that should I do this step in excel before importing to SAS or am I able to do it in SAS? In my raw data I have the following;

PID: different companies ID, Rating2015_B: rating at the beggining of 2015, Ratinh2015_E: rating at the end of 2015.

I was thinking to create a column Rating2016_D that is for rating at the end of 2015 for those that went to defaults in excel.

Secondly, how can I create a variable called probability of defaults (PD) in SAS?

I know If my data would be smaller I could use (DATA, input, datalines) procedure but since my data has 15,085 observations I don't think that procedure is appropriate.

I would greatly appreciate any help and advice.

Super User
Posts: 23,346

## Re: Create probability default from raw data

The more lines the better to bring it into SAS.

Start off off with a PROC IMPORT to read in your data.

Then calculate your default variable using a data step.

Super User
Posts: 13,358

## Re: Create probability default from raw data

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

To provide example data follow instruction here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to create data step code that you can post or attach as a text file. We can run the posted code to generate data to test code with and avoid multiple questions about things like variable types.

Discussion stats
• 4 replies
• 430 views
• 0 likes
• 3 in conversation