[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

1 ACCEPTED SOLUTION

Accepted Solutions

## Finding percentiles

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
6 REPLIES 6

## Finding percentiles

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

## Re: Finding percentiles

Hi Miller,

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,

## Re: Finding percentiles

``````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

## Re: Finding percentiles

Many thanks for help me out.

## Re: Finding percentiles

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;``````

## Re: Finding percentiles

I am thankful for your support.

Discussion stats
• 6 replies
• 258 views
• 3 likes
• 3 in conversation