- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
[1.8] Produce detailed summary statistics for
credit limit and total transaction amount.
Find the 75th percentile (or 3rd quartile) values of
credit limit and total transaction amount. Filter the rows
in the `credit` dataset so that it contains only customers
who are above the 75th percentile for both variables.
Use a function to create a variable `Capacity` that contains
the customer's total transaction amount or credit limit,
whichever is higher
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This seems like a homework problem. We are happy to help, if you can show us the code you have already written. But most people here will not do your homework for you.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This seems like a homework problem. We are happy to help, if you can show us the code you have already written. But most people here will not do your homework for you.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Miller,
Thanks for your reply,
I have successfully written code to calculate the 75th percentile (or 3rd quartile) values for both credit limit and total transaction amount in our dataset, as outlined below:
proc means data = credit_nodup
qntldef=3
n median q1 q3;
var Credit_limit Total_Trans_Amt;
output out=credit_SummaryStats;
run;
Now, I am facing a challenge in merging this 75th percentile data with the original dataset. I would greatly appreciate your guidance on how to accomplish this task.
Thank you very much for your assistance.
Warm regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc means data = credit_nodup qntldef=3;
var Credit_limit Total_Trans_Amt;
output out=credit_SummaryStats p75= / autoname;
run;
/* Merge 75th percentile into original data set */
data combined;
if _n_=1 then set credit_summarystats(drop=_type_ _freq_);
set credit_nodup;
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks for help me out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Make sure to give names to the variables you want to hold the statistics of interest when you generate the summary dataset.
proc means data = credit_nodup
qntldef=3
n median q1 q3
;
var Credit_limit Total_Trans_Amt;
output out=credit_SummaryStats n= median= q1= q3= / autoname;
run;
No need to "merge", just set the single observation dataset once and the values will be retained onto every observation read from the original dataset.
data want;
set credit_nodup;
if _N_=1 then set credit_SummaryStats;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am thankful for your support.