[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
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
n median q1 q3;
var Credit_limit Total_Trans_Amt;
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.
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;
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;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.