Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- Graphics
- /
- Turn Histogram into a Line Graph - With Markers

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 08-25-2015 08:26 AM
(1585 views)

I have been searching for a long time for the correct code to do this, but I have not found it yet. I have n = 20,000 cases. I have already sorted the order of the data by RESERVE from low to high. Basically I would like to see how all 20,000 records distribute with either the count or the % on the y-axis. No need for another variable. Sort of a very big histogram turned into a line graph.

Then, to add a little complexity to it, I would like to mark a few points on the graph. Currently my RESERVE variable goes from 100 to about 5 million. But it would be nice if I could denote where 100,000 is, or where 20,000 is in my distribution.

Thank you very much in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You might want to consider using a kernel density estimate instead of a histogram. Run these two programs and compare the output:

proc sgplot data=sashelp.heart;

histogram weight;

run;

proc sgplot data=sashelp.heart;

density weight / type=kernel scale=percent;

run;

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You might want to consider using a kernel density estimate instead of a histogram. Run these two programs and compare the output:

proc sgplot data=sashelp.heart;

histogram weight;

run;

proc sgplot data=sashelp.heart;

density weight / type=kernel scale=percent;

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much Dan. Unfortunately my data is a bit on the side of being "super skewed." So I use the following code to graph it when I break my full distribution into 100 bins. The graph is much more healthy looking. Any suggestions on how to get markers in here to denote particular breaks in the distribution?

proc rank data = CLAIMS_DATA out = CLAIMS_DATA groups = 100;

var TRENDED_INCURRED;

ranks B_TRENDED_INCURRED;

run;

ods output "Summary statistics"=STATS;

proc means data = CLAIMS_DATA mean;

var TRENDED_INCURRED;

class B_TRENDED_INCURRED;

run;

quit;

ods output close;

proc sgplot data = STATS;

series x = B_TRENDED_INCURRED Y = TRENDED_INCURRED_Mean;

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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!

How to Concatenate Values

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.