DATA Step, Macro, Functions and more

bootstrap for default rates

Reply
Occasional Contributor
Posts: 10

bootstrap for default rates

Hello, I would like some help with this question:

 

The data contains S&P rating information for around 15,000 companies at the beginning as well as end of the year 2015.

PID: a serial number representing company ID;

Rating2015_B:  S&P rating at the beginning of the year 2015;

Rating2015_E: S&P rating at the end of the year 2015, “D” means company defaults at the end of year

Use the nonparametric bootstrap method (exclude the defaults) to generate 95% confidence intervals for default rates of each rating category.  

Explore the relationship between the length of CIs and number of bootstrap samples and confidence level. 

 

I have this code: 

 

proc surveyselect data=Mylib.LoanData

     method=SRS

     n=100

     reps=100

     seed=9999

     out=Mylib.LoanDataBootStrapCor;run;

proc corr data=Mylib.LoanDataBootStrapCor;

     by replicate;var Rating_2015B;

     ods output PearsonCorr=Mylib.BootStrapPearsonCorr;

run;

data Mylib.BootStrapPearsonCorr1;

     set Mylib.BootStrapPearsonCorr;

     by replicate;

     if first.replicate then delete;

run;

proc univariate data=Mylib.BootStrapPearsonCorr1 pctldef=4; var Rating_2015B;

     output out=Mylib.BootStrapCorCI pctlpts=&pctlpts. pctlpre=pct_; run;

proc print data=Mylib.BootStrapCorCI; run;

 

I would like to get some help and understand where I am going wrong and if this code is correct for this particular question. 

When i run the code, i'm getting error as sas is not recognizing BootStrapPearsonCorr1 and BootStrapCorCI

 

Thank you!

Super User
Posts: 23,999

Re: bootstrap for default rates

What does the log show?

Occasional Contributor
Posts: 10

Re: bootstrap for default rates

Capture.PNG

 

Thanks for your reply. This is what I see, but I am not sure what I should do next? 

 

I think the output should show something with this: 

Obs

pct_2_5

pct_97_5

 

is there anything wrong with the code? The code that i'm using was previously used for numerical data, but the rating data I am using right now as loan rating as and so forth. What modifications should be made to the code? thank you

B
B
BBB
BB
BB
BB+
Super User
Posts: 23,999

Re: bootstrap for default rates

Yes, there's something wrong with the code and that isn't the full log. 

You show errors in red. Fix them first, in the order they appear. I suspect you also have another error or note above. 

 

I don't think you're doing what you expect in this step for starters and probably where you issue originates since the dataset is not created or available for you later - the first error that I can see. 

 

proc corr data=Mylib.LoanDataBootStrapCor;

     by replicate;

    var Rating_2015B;

     ods output PearsonCorr=Mylib.BootStrapPearsonCorr;

run;

 

If you code has errors how can you trust the results? You can't. 


Anna7 wrote:

Capture.PNG

 

Thanks for your reply. This is what I see, but I am not sure what I should do next? 

 

I think the output should show something with this: 

Obs

pct_2_5

pct_97_5

 

is there anything wrong with the code? The code that i'm using was previously used for numerical data, but the rating data I am using right now as loan rating as and so forth. What modifications should be made to the code? thank you

B
B
BBB
BB
BB
BB+

 

Occasional Contributor
Posts: 10

Re: bootstrap for default rates

The code that I sent above I had edited it little for my dataset.

 

But this is the original code 

Capture.PNG

 

and here is the dataset for that code:

 

Capture.PNG

 

and this is the current dataset I need to use:

 

Capture.PNG

 

and I need to Use the nonparametric bootstrap method to generate 95% confidence intervals for default rates of each rating category.

 

I am confused as to how to go about the code for this requirement. 

Super User
Posts: 23,999

Re: bootstrap for default rates

That doesn’t change the fact that your log is full of errors. Did you fix your PROC CORR step. 

 

Note that we can’t do anything with pictures, To work with it we’d first have to type it out. You should include what you expect as output as well. 

 


Anna7 wrote:

The code that I sent above I had edited it little for my dataset.

 

But this is the original code 

Capture.PNG

 

and here is the dataset for that code:

 

Capture.PNG

 

and this is the current dataset I need to use:

 

Capture.PNG

 

and I need to Use the nonparametric bootstrap method to generate 95% confidence intervals for default rates of each rating category.

 

I am confused as to how to go about the code for this requirement. 


 

Occasional Contributor
Posts: 10

Re: bootstrap for default rates

Thank you, will try to use a different method and see if it works. 

Ask a Question
Discussion stats
  • 6 replies
  • 213 views
  • 0 likes
  • 2 in conversation