<?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 mixed estimate and contrast statement in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-estimate-and-contrast-statement/m-p/74095#M3561</link>
    <description>Thanks Dale!&lt;BR /&gt;
&lt;BR /&gt;
The reason I wanted to know how to do this was just in case I ever needed to know how to do that I wouldnt be scrambling at last minute to figure it out</description>
    <pubDate>Fri, 24 Sep 2010 00:18:20 GMT</pubDate>
    <dc:creator>trekvana</dc:creator>
    <dc:date>2010-09-24T00:18:20Z</dc:date>
    <item>
      <title>proc mixed estimate and contrast statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-estimate-and-contrast-statement/m-p/74093#M3559</link>
      <description>hello all-&lt;BR /&gt;
&lt;BR /&gt;
how do i specify which the subject i want to use to estimate my random effects. for example say i have 160 subjects and i do:&lt;BR /&gt;
&lt;BR /&gt;
proc mixed;&lt;BR /&gt;
class subjects;&lt;BR /&gt;
model y=time;&lt;BR /&gt;
random intercept time/ sub=subjects type=un;&lt;BR /&gt;
&lt;B&gt;estimate "60th subject slope" int 1 | int 1 / sub 60;&lt;/B&gt;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
this doesnt give what i want. the only way i know to give me the 60th subject is to say&lt;BR /&gt;
&lt;BR /&gt;
estimate "60th subject slope" int 1 | int 1 / sub 0 0 0 0.....0 1;&lt;BR /&gt;
where we have 59 zeros and then a 1 for the 60th subject.&lt;BR /&gt;
&lt;BR /&gt;
im assuming its the same with the contrast statement. there must be a faster and better way right?&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: trekvana</description>
      <pubDate>Wed, 22 Sep 2010 19:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-estimate-and-contrast-statement/m-p/74093#M3559</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-22T19:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed estimate and contrast statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-estimate-and-contrast-statement/m-p/74094#M3560</link>
      <description>The only way that I know of to specify the 60th subject would be to issue 59 0 values and then a 1 for the 60th subject.  I am having trouble trying to figure out why you would want to that, but that is for another day.&lt;BR /&gt;
&lt;BR /&gt;
In order to implement something like selecting the 60th subject, I would use a macro to generate the subject specification coefficients.  Accordingly, you could code:&lt;BR /&gt;
&lt;BR /&gt;
%macro SubSpecEst(subject=);&lt;BR /&gt;
 &amp;nbsp; %let length_subj=%sysfunc(length(&amp;amp;subject));&lt;BR /&gt;
 &amp;nbsp; %let lastdigit=%sysfunc(substr(&amp;amp;subject,&amp;amp;length_subj));&lt;BR /&gt;
 &amp;nbsp; %if &amp;amp;lastdigit=1 %then %let superscript=st;  %else&lt;BR /&gt;
 &amp;nbsp; %if &amp;amp;lastdigit=2 %then %let superscript=nd; %else&lt;BR /&gt;
 &amp;nbsp; %if &amp;amp;lastdigit=3 %then %let superscript=rd;  %else&lt;BR /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%let superscript=th;&lt;BR /&gt;
 &amp;nbsp; estimate "&amp;amp;subject.&amp;amp;superscript. subject slope" time 1 | time 1 / subject&lt;BR /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%do i=1 %to %eval(&amp;amp;subject.-1); 0%end; 1;&lt;BR /&gt;
%mend SubSpecEst;&lt;BR /&gt;
&lt;BR /&gt;
(Note that I changed your intercept specification in the estimate statement to a time specification because the label indicated the slope for the 60th subject.)&lt;BR /&gt;
&lt;BR /&gt;
With this macro, one would then write:&lt;BR /&gt;
&lt;BR /&gt;
proc mixed;&lt;BR /&gt;
 &amp;nbsp; class subjects;&lt;BR /&gt;
 &amp;nbsp; model y=time;&lt;BR /&gt;
 &amp;nbsp; random intercept time/ sub=subjects type=un;&lt;BR /&gt;
 &amp;nbsp; %SubSpecEst(subject=60)&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 23 Sep 2010 21:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-estimate-and-contrast-statement/m-p/74094#M3560</guid>
      <dc:creator>Dale</dc:creator>
      <dc:date>2010-09-23T21:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: proc mixed estimate and contrast statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-estimate-and-contrast-statement/m-p/74095#M3561</link>
      <description>Thanks Dale!&lt;BR /&gt;
&lt;BR /&gt;
The reason I wanted to know how to do this was just in case I ever needed to know how to do that I wouldnt be scrambling at last minute to figure it out</description>
      <pubDate>Fri, 24 Sep 2010 00:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-mixed-estimate-and-contrast-statement/m-p/74095#M3561</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-24T00:18:20Z</dc:date>
    </item>
  </channel>
</rss>

