Programming the statistical procedures from SAS

To create Histogram in SAS-9.2

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,040
Accepted Solution

To create Histogram in SAS-9.2

I want to create a histogram. Generally histogram gives counts/ frequency on the Y-axis and the variable on the histogram statement in Proc univariate on Y-axis. I was given a specific period(1 year) and asked to create a histogram for the length of stay(days) for the particular diagnosis code. There might be many patients with the same code in that year and have different length of stay as shown.

code  LOStay   month

500    3             feb11

500    6            mar12

501    2             apr11

501    1            aug11

501     1            sep11

501     5           jun11

thousands of data

I want to create a seperate histogram for each code.

i seperated each code into a seperate data set and did a proc univariate.

on x-axis i got LOS and on Y-axis i got percent

IS THERE A POSSIBILITY TO GET a histogram with MONTH ON X-axis and LOS days for a particular code on y-axis??????????

Thanks in advance


Accepted Solutions
Solution
‎08-16-2012 10:54 AM
Super User
Posts: 10,874

Re: To create Histogram in SAS-9.2

It sounds like you may want either PROC GCHART or SGPLOT.

And if you sort your data by the code, use a BY CODE statement to generate multiple plots instead of many datasets and calls to the proc.

View solution in original post


All Replies
Solution
‎08-16-2012 10:54 AM
Super User
Posts: 10,874

Re: To create Histogram in SAS-9.2

It sounds like you may want either PROC GCHART or SGPLOT.

And if you sort your data by the code, use a BY CODE statement to generate multiple plots instead of many datasets and calls to the proc.

Super Contributor
Posts: 1,040

Re: To create Histogram in SAS-9.2

Thank you so very much for the answer. very helpful.....

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 495 views
  • 0 likes
  • 2 in conversation