<?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: plot a graph for Poisson regression in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514880#M138875</link>
    <description>&lt;P&gt;You didn't actually create an outputted data set, you need the OUT= portion.&lt;/P&gt;
&lt;P&gt;This should get you started then. Your SGPLOT syntax was also wrong so I just simplified it to make it work for now. You can add back the pieces as you get it working. Good Luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc genmod data = prog plots;
model nf= month / dist=Poisson type1 type3 ;
&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;output out=&lt;FONT color="#800080"&gt;want&lt;/FONT&gt; predicted=p;&lt;/STRONG&gt;&lt;/FONT&gt;
run;

proc sgplot &lt;FONT size="5"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;data=&lt;FONT color="#800080"&gt;want&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;
yaxis label="Number of failures";
scatter x=month y=p / name="points" ;
scatter x=month y=nf / name="line"  ;
run;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/245357"&gt;@shahd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;still not working&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data prog;&lt;BR /&gt;input nf month;&lt;BR /&gt;datalines;&lt;BR /&gt;5 18&lt;BR /&gt;3 15&lt;BR /&gt;1 14&lt;BR /&gt;4 23&lt;BR /&gt;0 10&lt;BR /&gt;0 5&lt;BR /&gt;1 8&lt;BR /&gt;0 7&lt;BR /&gt;0 12&lt;BR /&gt;0 3&lt;BR /&gt;1 7&lt;BR /&gt;0 2&lt;BR /&gt;7 30&lt;BR /&gt;0 9&lt;BR /&gt;proc genmod data = prog;&lt;BR /&gt;model nf= month / dist=Poisson type1 type3 ;&lt;BR /&gt;output predicted=p;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics on;&lt;BR /&gt;proc sort data=prog;by month;run;&lt;BR /&gt;proc sgplot data=prog;&lt;BR /&gt;yaxis label="Number of failures";&lt;BR /&gt;scatter x=month y=p / name="points"&lt;BR /&gt;legendLabel="number of failures";&lt;BR /&gt;series x=month y=nf / name="line"&lt;BR /&gt;legendLabel="Predicted number of failures"&lt;BR /&gt;lineattrs = GRAPHFIT;&lt;BR /&gt;discretelegend "points" "line";&lt;BR /&gt;run;&lt;BR /&gt;proc genmod plots=all;&lt;BR /&gt;model nf = month;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Nov 2018 18:16:47 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-11-20T18:16:47Z</dc:date>
    <item>
      <title>plot a graph for Poisson regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514832#M138861</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I wrote this code to &lt;STRONG&gt;Construct a graph of the fitted model versus months. Also to plot the observed number of failures on this graph.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But the code results doesn't show this plot. Can you help with this please&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data prog;&lt;BR /&gt;input nf month;&lt;BR /&gt;datalines;&lt;BR /&gt;5 18&lt;BR /&gt;3 15&lt;BR /&gt;1 14&lt;BR /&gt;4 23&lt;BR /&gt;0 10&lt;BR /&gt;0 5&lt;BR /&gt;1 8&lt;BR /&gt;0 7&lt;BR /&gt;0 12&lt;BR /&gt;0 3&lt;BR /&gt;1 7&lt;BR /&gt;0 2&lt;BR /&gt;7 30&lt;BR /&gt;0 9&lt;BR /&gt;proc genmod data = prog;&lt;BR /&gt;model nf= month / dist=Poisson type1 type3 ;&lt;BR /&gt;run;&lt;BR /&gt;proc logistic data=prog;&lt;BR /&gt;model nf=month / aggregate scale=none;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics on;&lt;BR /&gt;proc sort data=prog;by month;run;&lt;BR /&gt;proc sgplot data=prog;&lt;BR /&gt;title "Problem 3.16.b";&lt;BR /&gt;yaxis label="Number of failures";&lt;BR /&gt;scatter x=month y=phat / name="points"&lt;BR /&gt;legendLabel="number of failures";&lt;BR /&gt;series x=month y=nf / name="line"&lt;BR /&gt;legendLabel="Predicted number of failures"&lt;BR /&gt;lineattrs = GRAPHFIT;&lt;BR /&gt;discretelegend "points" "line";&lt;BR /&gt;run;&lt;BR /&gt;proc genmod plots=all;&lt;BR /&gt;model nf = month;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 16:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514832#M138861</guid>
      <dc:creator>shahd</dc:creator>
      <dc:date>2018-11-20T16:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: plot a graph for Poisson regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514836#M138862</link>
      <description>You didn't create any output data sets from the PROC GENMOD or LOGISTIC to use to drive those plots. Your PROG data set has no predictions or phat.</description>
      <pubDate>Tue, 20 Nov 2018 16:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514836#M138862</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-20T16:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: plot a graph for Poisson regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514866#M138872</link>
      <description>&lt;P&gt;could you please help me to modify it&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 17:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514866#M138872</guid>
      <dc:creator>shahd</dc:creator>
      <dc:date>2018-11-20T17:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: plot a graph for Poisson regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514870#M138873</link>
      <description>Please try adding the OUTPUT statement to your PROC GENMOD and LOGISTIC. If you still can't get it after that attempt, post your code and I'll take a look. &lt;BR /&gt;&lt;BR /&gt;PROC LOGISTIC OUTPUT statement&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_logistic_syntax27.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_logistic_syntax27.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;PROC GENMOD output statement &lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_genmod_syntax24.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_genmod_syntax24.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en&lt;/A&gt;</description>
      <pubDate>Tue, 20 Nov 2018 17:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514870#M138873</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-20T17:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: plot a graph for Poisson regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514875#M138874</link>
      <description>&lt;P&gt;still not working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data prog;&lt;BR /&gt;input nf month;&lt;BR /&gt;datalines;&lt;BR /&gt;5 18&lt;BR /&gt;3 15&lt;BR /&gt;1 14&lt;BR /&gt;4 23&lt;BR /&gt;0 10&lt;BR /&gt;0 5&lt;BR /&gt;1 8&lt;BR /&gt;0 7&lt;BR /&gt;0 12&lt;BR /&gt;0 3&lt;BR /&gt;1 7&lt;BR /&gt;0 2&lt;BR /&gt;7 30&lt;BR /&gt;0 9&lt;BR /&gt;proc genmod data = prog;&lt;BR /&gt;model nf= month / dist=Poisson type1 type3 ;&lt;BR /&gt;output predicted=p;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics on;&lt;BR /&gt;proc sort data=prog;by month;run;&lt;BR /&gt;proc sgplot data=prog;&lt;BR /&gt;yaxis label="Number of failures";&lt;BR /&gt;scatter x=month y=p / name="points"&lt;BR /&gt;legendLabel="number of failures";&lt;BR /&gt;series x=month y=nf / name="line"&lt;BR /&gt;legendLabel="Predicted number of failures"&lt;BR /&gt;lineattrs = GRAPHFIT;&lt;BR /&gt;discretelegend "points" "line";&lt;BR /&gt;run;&lt;BR /&gt;proc genmod plots=all;&lt;BR /&gt;model nf = month;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 18:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514875#M138874</guid>
      <dc:creator>shahd</dc:creator>
      <dc:date>2018-11-20T18:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: plot a graph for Poisson regression</title>
      <link>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514880#M138875</link>
      <description>&lt;P&gt;You didn't actually create an outputted data set, you need the OUT= portion.&lt;/P&gt;
&lt;P&gt;This should get you started then. Your SGPLOT syntax was also wrong so I just simplified it to make it work for now. You can add back the pieces as you get it working. Good Luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc genmod data = prog plots;
model nf= month / dist=Poisson type1 type3 ;
&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;output out=&lt;FONT color="#800080"&gt;want&lt;/FONT&gt; predicted=p;&lt;/STRONG&gt;&lt;/FONT&gt;
run;

proc sgplot &lt;FONT size="5"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;data=&lt;FONT color="#800080"&gt;want&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;
yaxis label="Number of failures";
scatter x=month y=p / name="points" ;
scatter x=month y=nf / name="line"  ;
run;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/245357"&gt;@shahd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;still not working&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data prog;&lt;BR /&gt;input nf month;&lt;BR /&gt;datalines;&lt;BR /&gt;5 18&lt;BR /&gt;3 15&lt;BR /&gt;1 14&lt;BR /&gt;4 23&lt;BR /&gt;0 10&lt;BR /&gt;0 5&lt;BR /&gt;1 8&lt;BR /&gt;0 7&lt;BR /&gt;0 12&lt;BR /&gt;0 3&lt;BR /&gt;1 7&lt;BR /&gt;0 2&lt;BR /&gt;7 30&lt;BR /&gt;0 9&lt;BR /&gt;proc genmod data = prog;&lt;BR /&gt;model nf= month / dist=Poisson type1 type3 ;&lt;BR /&gt;output predicted=p;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics on;&lt;BR /&gt;proc sort data=prog;by month;run;&lt;BR /&gt;proc sgplot data=prog;&lt;BR /&gt;yaxis label="Number of failures";&lt;BR /&gt;scatter x=month y=p / name="points"&lt;BR /&gt;legendLabel="number of failures";&lt;BR /&gt;series x=month y=nf / name="line"&lt;BR /&gt;legendLabel="Predicted number of failures"&lt;BR /&gt;lineattrs = GRAPHFIT;&lt;BR /&gt;discretelegend "points" "line";&lt;BR /&gt;run;&lt;BR /&gt;proc genmod plots=all;&lt;BR /&gt;model nf = month;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 18:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/plot-a-graph-for-Poisson-regression/m-p/514880#M138875</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-20T18:16:47Z</dc:date>
    </item>
  </channel>
</rss>

