BookmarkSubscribeRSS Feed
Anna7
Calcite | Level 5

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!

6 REPLIES 6
Reeza
Super User

What does the log show?

Anna7
Calcite | Level 5

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+
Reeza
Super User

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+

 

Anna7
Calcite | Level 5

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. 

Reeza
Super User

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. 


 

Anna7
Calcite | Level 5

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 941 views
  • 0 likes
  • 2 in conversation