Is it possible to create a histgram with only 2 uneven bins: ">= median" and "< median" ? Using either proc univariate, or sgplot. How to set the middle or endpoint? Thanks
What do you mean by endpoints? If I understand you correctly, you can do something like this
proc sql;
create table temp as
select *,
median(height),
(case
when height lt median(height) then "< median"
when height ge median(height) then ">= median"
end) as overunder
from sashelp.class;
quit;
proc sgplot data=temp;
vbar overunder;
run;
What do you mean by endpoints? If I understand you correctly, you can do something like this
proc sql;
create table temp as
select *,
median(height),
(case
when height lt median(height) then "< median"
when height ge median(height) then ">= median"
end) as overunder
from sashelp.class;
quit;
proc sgplot data=temp;
vbar overunder;
run;
@HappySASUE wrote:
Is it possible to create a histgram with only 2 uneven bins: ">= median" and "< median" ? Using either proc univariate, or sgplot. How to set the middle or endpoint? Thanks
Sure, that's just a bar chart though, I wouldn't call it a histogram. And in theory, it should be a straight line because that's the definition of the median.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.