Hello everyone,
I have a question formatting my syntax. I have a large data set but I am trying to make a box plot of the frequency of the a specific variable.
I have variable subject ID, and measurement A.
measurement A ranges from 20 mm to 30 mm
I have to see how many people are in measurment A from 20-20.99, 21-21.99, to 29-29.99
Please help.
Thank you
I made up some random data, and then I used PROC SGPLOT (not PROC GPLOT, which is an older procedure) to generate the plot.
data random;
do i=1 to 275;
y=rand('uniform')*10+20;
output;
end;
run;
proc sgplot data=random;
histogram y/binstart=20 binwidth=1 scale=count showbins;
run;
Typically, you do not use box plots to show "the frequency of the a specific variable." Box plots are designed to show the continuous distribution of a variable, I'm sure you can find examples in the SAS documentation or on the internet.
I have to see how many people are in measurement A from 20-20.99, 21-21.99, to 29-29.99
This sounds like a histogram, or perhaps PROC FREQ. Is that what you want?
Thank you Paige,
Yes you were right, it was a box plot but how can i format the syntax so the labels be from 20-30 increments of 1.
or can I write my own labels?
I'm sorry, I still don't understand what plot you want.
Yes you were right, it was a box plot
This statement of yours is contradictory, I say you don't want a box plot and you say you do want a box plot, and I'm right?
Can you find a similar plot on the Internet and show us a screen capture?
Can you show us a small example of data set and explain how this turns into a box plot?
Sorry for the confusion. I met a bar graph.
So I am using proc gchart to create a bar graph.
In my data set I have n= 4135 subjects, with measurement x. Some subjects don't have a x measurement.
measurement x ranges from 20-30mm.
What I want to create is a bar graph of the number of people based on x.
I made up some random data, and then I used PROC SGPLOT (not PROC GPLOT, which is an older procedure) to generate the plot.
data random;
do i=1 to 275;
y=rand('uniform')*10+20;
output;
end;
run;
proc sgplot data=random;
histogram y/binstart=20 binwidth=1 scale=count showbins;
run;
can I add something to show the actual number count on each bar?
Thank you for all your help.
histogram y/binstart=20 binwidth=1 scale=count showbins datalabel=count;
thank you once again
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.