title: SAS GLIMMIX subject estimates
body: <p>I am trying to analyze a dataset where each subject has 12 repeated measures (quarterly over 3 years). I want to extract subject specific estimates of the time slope to evaluate if the subjects are changing significantly over time. </p>
  
  <p>The code I currently have consistently suggests that each subject is demonstrating a highly significant increase over time. This seems unlikely but I'm not sure how to adjust my syntax to run a more accurate model. Does anyone know how/why this model would find the slope coefficient for time significant for all cases?</p>
  
  <p>A quick description of the study: We are creating a trending report which should flag procedure codes (subjects) that are showing a significant increase in the number of times it was billed over the time period being analyzed (3 years, by quarter). The outcome variable is being treated as a count (bounded at 0 but not necessarily whole numbers). </p>
  
  <pre><code>%macro Zeroes(numzeroes);
     %local i;
     %do i = 1 %to %eval(&amp;numzeroes-1);
        0
     %end;
     1;
  %mend;
  
  %macro EstimateStatement(numsubjects=);
     %local i;
  
     proc glimmix data=procdata11;
        class code;
        model billing_count=period_count / dist=NB link=log
        solution ddfm=betwithin;
        random intercept period_count / sub=code type=AR(1);
        random _residual_;  
        %do i = 1 %to &amp;numsubjects;
           estimate "Slope for Code &amp;i" period_count 1 | period_count 1 / subject %Zeroes(&amp;i);
         %end;
        ods output estimates=sscoeff;
      run;
   %mend;
  
   %EstimateStatement(numsubjects=&amp;num_codes)
  </code></pre>
  
  <p>Any help on making this model more accurate and efficient would be greatly appreciated!</p>
  
  <p>Thanks!</p>