<?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: Proc Genmod and continuous variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384536#M20000</link>
    <description>&lt;P&gt;An other solution is to use proc plm for calculating predictions for any values in some dataset. In my little example I make a dataset "template" which contains the values of covariates. In your example this dataset should just have one observation with age=23.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output data will contain the &lt;STRONG&gt;linear&lt;/STRONG&gt; predictor. So if you want it on the original scale, you should add to&amp;nbsp;this example&amp;nbsp;a step where you calculate exp(pred). Confidence limit can be transformed with exp() also, and if you want the stderr on the original scale you should use the delta-rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*simulate som data;
data mydata;
  do i=1 to 1000;
    gender=(i&amp;lt;=500);
	age=mod(i,100);
	y=rand('gamma',exp(0.4*gender+0.01*age));
    output;
  end;
run;

*estimate the parameters and save the model;
proc genmod data=mydata;
  class gender;
  model y=gender age/dist=gamma link=log;
  store mymodel;
run;

*constructing values of covariates for which we want predictions;
data template;
  do gender=0,1;
    do age=20 to 30;
	output;
    end;
  end;
run;

*calculate confidence intervals with proc plm;
proc plm restore=mymodel;
  score data=template out=predict lclm=lclm uclm=uclm stderr=stderr pred=pred;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Aug 2017 09:15:22 GMT</pubDate>
    <dc:creator>JacobSimonsen</dc:creator>
    <dc:date>2017-08-01T09:15:22Z</dc:date>
    <item>
      <title>Proc Genmod and continuous variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/383890#M19986</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;i'm not sure if this is possible, i've&amp;nbsp;been searching for a while...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need to get the coefficients, standard errors and Wald's confidence intervals for a continuous variable in Proc genmod.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get the co-efficient estimate for Age (BetaA), and i know i can multiply the coefficient by each age to get the coefficient for each age (i.e 33 * BetaA), however, i'm&amp;nbsp;unsure on how to get the corresponding &amp;nbsp;Std. Error and Wald's confidence interval.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, it would be really handy if I can SAS to output the range of Ages used in ProcGenmod and output the values into ParameterEstimates (similar to the way it outputs them for categorical variables) - which is what &amp;nbsp;i really want!&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC GENMOD DATA = GLMDataset ;
		WEIGHT Quote. ;
		CLASS 	Gender /MISSING ;
		MODEL  PRICE = Gender Age  
			/DIST = Gamma.
			 LINK = LOG
			 TYPE1
			 TYPE3

			 ;
		OUTPUT 			OUT = GLMDatasetScored (keep = REFNO AVGPRICE PREMIUM: EST:. Gender Age )						
						PREDICTED	=	EST_AVGPRICE 
						LOWER		=	EST_LOWER_CI 
						UPPER 		=	EST_UPPER_CI
						RESDEV 	=	EST_DEVRES
						STDRESDEV	=	EST_STDDEVRES
						RESLIK 		=	EST_LIKLRES
						
						XBETA		=   EST_LINEARPREDICTOR					
						 ;
		ods output 	parameterestimates =  _ParamEst 
					modelfit = _Modelfit
					Type1 =  _Type1
					Type3 = _Type3;								
	RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 19:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/383890#M19986</guid>
      <dc:creator>Squibbles</dc:creator>
      <dc:date>2017-07-28T19:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Genmod and continuous variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384317#M19988</link>
      <description>&lt;P&gt;If you want the predicted mean for any given age in a given gender, that is in your OUTPUT OUT= data set. &amp;nbsp;Just find the observation with the given age and gender. &amp;nbsp;If what you want is a predicted mean for age averaged over the genders, then this would be something the LSMEANS statement would do for you if age were a CLASS (categorical) variable in the model. &amp;nbsp;Since it's not, you can use the ESTIMATE statement to compute an estimate similar to an LS-mean. &amp;nbsp;For example, assuming there are two genders and you want to treat them as having equal proportions in the population, then this statement would estimate the mean for age=20:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;estimate 'age=20' intercept 1 gender .5 .5 age 20;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384317#M19988</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2017-07-31T15:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Genmod and continuous variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384536#M20000</link>
      <description>&lt;P&gt;An other solution is to use proc plm for calculating predictions for any values in some dataset. In my little example I make a dataset "template" which contains the values of covariates. In your example this dataset should just have one observation with age=23.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output data will contain the &lt;STRONG&gt;linear&lt;/STRONG&gt; predictor. So if you want it on the original scale, you should add to&amp;nbsp;this example&amp;nbsp;a step where you calculate exp(pred). Confidence limit can be transformed with exp() also, and if you want the stderr on the original scale you should use the delta-rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*simulate som data;
data mydata;
  do i=1 to 1000;
    gender=(i&amp;lt;=500);
	age=mod(i,100);
	y=rand('gamma',exp(0.4*gender+0.01*age));
    output;
  end;
run;

*estimate the parameters and save the model;
proc genmod data=mydata;
  class gender;
  model y=gender age/dist=gamma link=log;
  store mymodel;
run;

*constructing values of covariates for which we want predictions;
data template;
  do gender=0,1;
    do age=20 to 30;
	output;
    end;
  end;
run;

*calculate confidence intervals with proc plm;
proc plm restore=mymodel;
  score data=template out=predict lclm=lclm uclm=uclm stderr=stderr pred=pred;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 09:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384536#M20000</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2017-08-01T09:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Genmod and continuous variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384551#M20001</link>
      <description>&lt;P&gt;great thanks, plm&amp;nbsp;should get to what i want. i'll look into LSMeans and Estimate, that might help with communicating results to a non-technical audience.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you both&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 10:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384551#M20001</guid>
      <dc:creator>Squibbles</dc:creator>
      <dc:date>2017-08-01T10:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Genmod and continuous variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384610#M20002</link>
      <description>&lt;P&gt;Like&amp;nbsp;the OUTPUT statement that I suggested earlier, PLM's SCORE statement will give you predictions for specified gender and age (note that you can use the ILINK option in PLM to get the predictions on the mean scale instead of on the linear predictor scale). But, as I mentioned, if you want predictions for specified levels of age without specifying gender (essentially averaging over genders as determined by the coefficients specified), then the ESTIMATE statement approach for doing an LS-mean-like calculation is helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 13:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Genmod-and-continuous-variables/m-p/384610#M20002</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2017-08-01T13:48:16Z</dc:date>
    </item>
  </channel>
</rss>

