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!
What does the log show?
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+ |
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:
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+
The code that I sent above I had edited it little for my dataset.
But this is the original code
and here is the dataset for that code:
and this is the current dataset I need to use:
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.
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
and here is the dataset for that code:
and this is the current dataset I need to use:
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.
Thank you, will try to use a different method and see if it works.
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!
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.