turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Histogram standart desviation

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-05-2013 07:08 PM

Hi all, I've been trying to make a graph using PROC UNIVARIATE, however I couldn't understand why is not possible show de first, second and the third standart desviation as the image below:

How can I show the S.D like the image above, using proc UNIVARIATE ?

tk's in advanced.

Accepted Solutions

Solution

06-06-2013
11:44 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-06-2013 11:44 AM

Starting with SAS 9.3m2, PROC UNIVARIATE enables you to place reference lines at the values of selected statistics, including multiples of the sample standard deviation. Here is some code and output. I have specified a list of bin midpoints so all the reference lines are displayed. (Axis ranges are not extended automatically to include reference lines.)

data foo;

do i = 1 to 100;

x = 10 + rannor(123);

output;

end;

run;

proc univariate data=foo noprint;

histogram x /

normal(noprint)

statref= -3std -2std -1std mean 1std 2std 3std

statreflabel= "-3 S.D" "-2 S.D" "-1 S.D" "" "1 S.D" "2 S.D" "3 S.D"

midpoints= 7 to 13 by 1

nocurvelegend;

run;

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-05-2013 07:46 PM

This is a custom graph, that you can make with SAS 9.3. Use PROC MEANS to get all the statistics you need and merge with original data used for histogram.

You can use SGPLOT procedure to create the histogram, and use REFLINE statement to overlay the lines for the SD values. then, you can annotate the rest of the formation.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-06-2013 08:55 AM

Hi Sanjay, could you send me a example ?

Doesn't SAS have a function to know the "z-scores" ?

Solution

06-06-2013
11:44 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-06-2013 11:44 AM

Starting with SAS 9.3m2, PROC UNIVARIATE enables you to place reference lines at the values of selected statistics, including multiples of the sample standard deviation. Here is some code and output. I have specified a list of bin midpoints so all the reference lines are displayed. (Axis ranges are not extended automatically to include reference lines.)

data foo;

do i = 1 to 100;

x = 10 + rannor(123);

output;

end;

run;

proc univariate data=foo noprint;

histogram x /

normal(noprint)

statref= -3std -2std -1std mean 1std 2std 3std

statreflabel= "-3 S.D" "-2 S.D" "-1 S.D" "" "1 S.D" "2 S.D" "3 S.D"

midpoints= 7 to 13 by 1

nocurvelegend;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-06-2013 12:06 PM

Hi, Bucky, first of all thank's for the tip, it was exactly what I'm trying to do, however, my SAS is 9.2.