<?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: mixed class level coding in PROC GENMOD? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/mixed-class-level-coding-in-PROC-GENMOD/m-p/4167#M1331</link>
    <description>Hi Peter, &lt;BR /&gt;
I know you posted this 2 years ago but my colleagues and I are having the same problem on an analysis we are doing. Did you ever find a solution to param=glm overriding everything? We want some variables GLM coded to get accurate odds ratios from estimate statements but we need others to be reference coded for interaction terms.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Amanda</description>
    <pubDate>Thu, 27 Aug 2009 15:03:00 GMT</pubDate>
    <dc:creator>Amanda_F_</dc:creator>
    <dc:date>2009-08-27T15:03:00Z</dc:date>
    <item>
      <title>mixed class level coding in PROC GENMOD?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/mixed-class-level-coding-in-PROC-GENMOD/m-p/4165#M1329</link>
      <description>Dear all,&lt;BR /&gt;
I am using SAS 9.1.3 on the windows platform to perform a logistic-type analysis. I am treating all my variables as class-level. Imagine that I have 1 independent variable x1 that I would like to treat as reference-level coded, and 1 independent variable x2 for which I need GLM-type coding (same number of estimates as levels of x2). I am using the /noint option, so, in a way, you could say that I am estimating an intercept for each level of x2.&lt;BR /&gt;
According to the documentation, the GLM coding can only be used as global option, but, according to the same documentation, variable-level options override the global option.&lt;BR /&gt;
&lt;BR /&gt;
"Global v-options are applied to all the variables specified in the CLASS statement. If you specify more than one CLASS statement, the global v-options specified on any one CLASS statement apply to all CLASS statements. However, individual CLASS variable v-options override the global v-options."&lt;BR /&gt;
&lt;BR /&gt;
In principle, that means that my case can easily be solved by using this class statement:&lt;BR /&gt;
class x1(param=ref) x2 /param=GLM;&lt;BR /&gt;
&lt;BR /&gt;
However, in fitting the model, the reference coding instruction gets ignored, and SAS gives me 1 estimate per level for x1, and 1 less than 1 per level for x2. Either there is something wrong in the implementation, in the documentation, or, of course, in my code.&lt;BR /&gt;
For whoever wants to try it, there's a piece of sample code that shows what I mean.&lt;BR /&gt;
&lt;BR /&gt;
In fact, I also want to raise a question about what "GLM coding" means. In the documentation, there is an example of a class-level variable with 4 levels. The GLM-design matrix is a diagonal matrix, with 1 on the diagonal and 0 in other cells. That would suggest that this coding generates 4 estimates. Yet, immediately under the table, the documentation states: "Parameter estimates of CLASS main effects using the GLM coding scheme estimate the difference in the effects of each level compared to the last level." This sounds like reference coding.&lt;BR /&gt;
&lt;BR /&gt;
I'd be grateful for any hint on what I'm doing or understanding wrongly. Thanks,&lt;BR /&gt;
Peter.&lt;BR /&gt;
&lt;BR /&gt;
data genmodtest;input b_a orientdeg freq_a n_ab;datalines;&lt;BR /&gt;
0.80   0  1 4&lt;BR /&gt;
0.80   90 2 4&lt;BR /&gt;
1 0  1 4&lt;BR /&gt;
1 90 2 4&lt;BR /&gt;
1.25   0  3 4&lt;BR /&gt;
1.25   90 2 4&lt;BR /&gt;
;quit;&lt;BR /&gt;
&lt;BR /&gt;
proc genmod data=genmodtest;&lt;BR /&gt;
class b_a(param=ref ref='1') orientdeg /param=GLM;&lt;BR /&gt;
model freq_a/n_ab=b_a orientdeg /noint dist=binomial;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 13 Aug 2007 18:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/mixed-class-level-coding-in-PROC-GENMOD/m-p/4165#M1329</guid>
      <dc:creator>peterc_2</dc:creator>
      <dc:date>2007-08-13T18:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: mixed class level coding in PROC GENMOD?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/mixed-class-level-coding-in-PROC-GENMOD/m-p/4166#M1330</link>
      <description>In my opinion, PARAM=GLM and PARAM=REF were both sides of the same kind of parametrization. Both provide comparisons to a reference level ; the only differences are :&lt;BR /&gt;
- you cannot choose the reference level with PARAM=GLM, it is always the last formatted value in alphabetic order that is chosen as reference ;&lt;BR /&gt;
- you will not see the zeroed coefficient for the reference with PARAM=REF.&lt;BR /&gt;
&lt;BR /&gt;
I prefer to use PARAM=GLM to show that explicit zero, and use a format to re-order my values and have the reference be the last one.&lt;BR /&gt;
Also useful, PARAM=EFFECT compares to overall mean ; that means that all coefficients for a variables sum to zero. This is nice since it avoids the problem of choosing a meaningful reference ; but it does not display the last coefficient either, as PARAM=REF does, so you have to compute it by yourself.&lt;BR /&gt;
&lt;BR /&gt;
On my computer (SAS 9.1.3 SP4), this code&lt;BR /&gt;
proc genmod data=genmodtest;&lt;BR /&gt;
class b_a(param=ref) orientdeg(param=effect) ;&lt;BR /&gt;
model freq_a/n_ab=b_a orientdeg /noint ;&lt;BR /&gt;
run; &lt;BR /&gt;
gives mixed parametrization without error.&lt;BR /&gt;
I dunno if it solves your problem, but I hope it is of any help.&lt;BR /&gt;
&lt;BR /&gt;
Olivier</description>
      <pubDate>Thu, 23 Aug 2007 09:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/mixed-class-level-coding-in-PROC-GENMOD/m-p/4166#M1330</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2007-08-23T09:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: mixed class level coding in PROC GENMOD?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/mixed-class-level-coding-in-PROC-GENMOD/m-p/4167#M1331</link>
      <description>Hi Peter, &lt;BR /&gt;
I know you posted this 2 years ago but my colleagues and I are having the same problem on an analysis we are doing. Did you ever find a solution to param=glm overriding everything? We want some variables GLM coded to get accurate odds ratios from estimate statements but we need others to be reference coded for interaction terms.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Amanda</description>
      <pubDate>Thu, 27 Aug 2009 15:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/mixed-class-level-coding-in-PROC-GENMOD/m-p/4167#M1331</guid>
      <dc:creator>Amanda_F_</dc:creator>
      <dc:date>2009-08-27T15:03:00Z</dc:date>
    </item>
  </channel>
</rss>

