<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Normal Distribution in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74853#M2773</link>
    <description>Unfortunately SGPLOT is a 9.2 proc and we have 9.1</description>
    <pubDate>Wed, 14 Oct 2009 16:28:24 GMT</pubDate>
    <dc:creator>darrylovia</dc:creator>
    <dc:date>2009-10-14T16:28:24Z</dc:date>
    <item>
      <title>Normal Distribution</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74849#M2769</link>
      <description>All&lt;BR /&gt;
I am running a simple z-test and instead of displaying the data in a table, i.e. z-score=.67 and z-statistic at 95% = 1.96.  I would like to display the test statistics graphically.  &lt;BR /&gt;
&lt;BR /&gt;
-1) Draw a normal distribution plot.&lt;BR /&gt;
-2) on the graph put a marker for the threshold value 95% z (1.96) and fill with color values above the threshold&lt;BR /&gt;
-3) Put a marker for the calculated z-score so the customer can visually see if the statistics is in the rejection zone. (above 1.96 or below -1.96).&lt;BR /&gt;
&lt;BR /&gt;
Also, I am using Enterprise Guide 4.1 and SAS 9.1 is the SAS server.&lt;BR /&gt;
Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Wed, 07 Oct 2009 11:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74849#M2769</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2009-10-07T11:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Normal Distribution</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74850#M2770</link>
      <description>I don't have an example of exactly what you're looking for, but I think this one might be close:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://robslink.com/SAS/democd12/normal.htm" target="_blank"&gt;http://robslink.com/SAS/democd12/normal.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://robslink.com/SAS/democd12/normal_info.htm" target="_blank"&gt;http://robslink.com/SAS/democd12/normal_info.htm&lt;/A&gt;</description>
      <pubDate>Fri, 09 Oct 2009 12:54:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74850#M2770</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2009-10-09T12:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Normal Distribution</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74851#M2771</link>
      <description>Robert Thanks&lt;BR /&gt;
I filled in the tails by drawing a bunch of vertical lines using the annotate facility.  I pasted the code below.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
** Sources: SAS System for Statistical Graphs, Michael Friendly, 1st Edition **;&lt;BR /&gt;
**               Also see normal distribution, wiki;&lt;BR /&gt;
**              &lt;A href="http://robslink.com/SAS/democd24/multdist_info.htm" target="_blank"&gt;http://robslink.com/SAS/democd24/multdist_info.htm&lt;/A&gt;;&lt;BR /&gt;
%let z_cutoff=1.96;&lt;BR /&gt;
%let z_score=.8;&lt;BR /&gt;
&lt;BR /&gt;
data normal;&lt;BR /&gt;
  a=1 / sqrt(2 * constant('PI'));&lt;BR /&gt;
 &lt;BR /&gt;
  do x=-3.5 to 3.5 by .01;&lt;BR /&gt;
    y= a * exp(-(x**2)/2);&lt;BR /&gt;
	if x&amp;gt;= &amp;amp;z_cutoff then z=y;&lt;BR /&gt;
	  else if x&amp;lt;=-&amp;amp;z_cutoff then z=y;&lt;BR /&gt;
	  else call missing(z95);&lt;BR /&gt;
	output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data anno_data;&lt;BR /&gt;
  length function color $8 text $32;&lt;BR /&gt;
  retain color 'red'&lt;BR /&gt;
         xsys ysys '2'&lt;BR /&gt;
		 size 1;&lt;BR /&gt;
  a=1 / sqrt(2 * constant('PI'));&lt;BR /&gt;
&lt;BR /&gt;
  do x=1.96 to 3.5 by .01;&lt;BR /&gt;
    function='move';&lt;BR /&gt;
    y=0;&lt;BR /&gt;
    output;&lt;BR /&gt;
    y=a * exp(-(x**2)/2);&lt;BR /&gt;
    function='draw';&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
&lt;BR /&gt;
  do x=-3.5 to -1.96 by .01;&lt;BR /&gt;
    function='move';&lt;BR /&gt;
    y=0;&lt;BR /&gt;
    output;&lt;BR /&gt;
    y=a * exp(-(x**2)/2);&lt;BR /&gt;
    function='draw';&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
&lt;BR /&gt;
  function='label';&lt;BR /&gt;
  text="Z-Score= "||strip(put(&amp;amp;z_score,z4.2));&lt;BR /&gt;
  x=2;&lt;BR /&gt;
  y=.35;&lt;BR /&gt;
  style='swiss';&lt;BR /&gt;
  color='black';&lt;BR /&gt;
  size=3;&lt;BR /&gt;
  when='A';   &lt;BR /&gt;
  output;&lt;BR /&gt;
  &lt;BR /&gt;
  function='label';&lt;BR /&gt;
  text="Z-Cut Off= &amp;amp;z_cutoff";&lt;BR /&gt;
  x=2;&lt;BR /&gt;
  y=.33;&lt;BR /&gt;
  style='swiss';&lt;BR /&gt;
  color='black';&lt;BR /&gt;
  size=3;&lt;BR /&gt;
  when='A';   &lt;BR /&gt;
  output;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc gplot data=normal;&lt;BR /&gt;
  plot  y * x/  href=0 &amp;amp;z_score chref=(black green) lhref=20 anno=anno_data&lt;BR /&gt;
               vaxis=axis1 haxis=axis2  ;&lt;BR /&gt;
  symbol1 i=join v=none c=black;&lt;BR /&gt;
  axis1 order=0 to .4 by .1&lt;BR /&gt;
       label=(f=titalic h=2 a=90 r=0 'Probability')&lt;BR /&gt;
       value=(f=duplex h=1.8) minor=none;&lt;BR /&gt;
  axis2 label=(f=titalic h=2 'Standard Deviations')&lt;BR /&gt;
        value=(f=duplex h=1.8) minor=none;&lt;BR /&gt;
  format y 3.1;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 14 Oct 2009 12:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74851#M2771</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2009-10-14T12:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Normal Distribution</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74852#M2772</link>
      <description>This is a good use case where you can get the benefit of the SGPlot procedure that supports band plots.  Here is the code.  Note the small change in the data step to compute z1 and  z2 (used to draw the bands).&lt;BR /&gt;
&lt;BR /&gt;
%let z_cutoff=1.96;&lt;BR /&gt;
%let z_score=.8;&lt;BR /&gt;
&lt;BR /&gt;
data normal2;&lt;BR /&gt;
  a=1 / sqrt(2 * constant('PI'));&lt;BR /&gt;
 &lt;BR /&gt;
  do x=-3.5 to 3.5 by .01;&lt;BR /&gt;
    z1=.;  z2=.;&lt;BR /&gt;
    y= a * exp(-(x**2)/2);&lt;BR /&gt;
	if x&amp;gt;= &amp;amp;z_cutoff then z1=y;&lt;BR /&gt;
	if x&amp;lt;=-&amp;amp;z_cutoff then z2=y;&lt;BR /&gt;
	output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods html file='Normal.htm';&lt;BR /&gt;
ods graphics / reset imagename='normal';&lt;BR /&gt;
proc sgplot data=normal2;&lt;BR /&gt;
  label x='Standard Deviations';&lt;BR /&gt;
  label y='Probability';&lt;BR /&gt;
  band x=x upper=z1 lower=0;&lt;BR /&gt;
  band x=x upper=z2 lower=0;&lt;BR /&gt;
  series x=x y=y;&lt;BR /&gt;
  xaxis values=(-4 to 4 by 1);&lt;BR /&gt;
  inset ("Z-Score =" = "&amp;amp;z_score" "Z-Cutoff =" = "&amp;amp;z_cutoff") / border osition=topright;&lt;BR /&gt;
  run;&lt;BR /&gt;
ods html close;</description>
      <pubDate>Wed, 14 Oct 2009 14:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74852#M2772</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2009-10-14T14:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Normal Distribution</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74853#M2773</link>
      <description>Unfortunately SGPLOT is a 9.2 proc and we have 9.1</description>
      <pubDate>Wed, 14 Oct 2009 16:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Normal-Distribution/m-p/74853#M2773</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2009-10-14T16:28:24Z</dc:date>
    </item>
  </channel>
</rss>

