BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
TuAnh
Fluorite | Level 6

[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
PaigeMiller
Diamond | Level 26

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

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

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
TuAnh
Fluorite | Level 6

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,



PaigeMiller
Diamond | Level 26
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
TuAnh
Fluorite | Level 6

Many thanks for help me out. 

Tom
Super User Tom
Super User

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;
TuAnh
Fluorite | Level 6

I am thankful for your support. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 540 views
  • 3 likes
  • 3 in conversation