I have a data set named A including two columns:
I wuld like to draw histogram which reflects 'Booking_Lead' and its corresponding 'Avg_Percent'. Besides, I would like to draw a 90% quantile that starting from the largest 'Booking_Lead', and in this example, it is between 0 and 1, but near 1. And output the result called Table B.
I have tried the following:
ods graphics off;
proc univariate data=A noprint;
histogram Booking_Lead /BARLABEL=percent STATREF=P 90 STATREFLABEL="90th Pctl";
output out=B p90=p90pct;
But this is not correct, How could I change the code, please?
It looks like your data is a summarization of the raw data. Does the avg_percent column sum to 1? Do you have the raw data? If so, please post as a DATA step, not as an image file.
If you don't have the raw data, then compute the cumulative proportions by summing the avg_percent column:
cum_percent + avg_percent;
The first observation for which cum_percent >= 0.9 is an estimate of the 90th percentile.
Thank you! The 'Avg_Percent' column sum to 1. And my prior code to obtain this data is as below:
Create Table Work.A
as select distinct
avg(Percentage) as Avg_Percent
group by 1, 2, 3, 4
order by 4 desc;
And I figured out the corresponding 'Booking_Lead' versus 90% quantile from your hint.
SAS is headed back 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.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
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.