FOCUS AREAS

SAS/ETS Examples

Analysis of Unobserved Component Models Using PROC UCM


Contents | Back to Example

SAS Program

   /*-----------------------------------------------------------------
     Example: Analysis of Unobserved Component Models Using PROC UCM
     Requires: SAS/ETS
     Version: 9.0
     ------------------------------------------------------------------*/

   data melanoma ;
      input Incidences @@ ;
      year = intnx('year','1jan1936'd,_n_-1) ;
      format year year4. ;
      label Incidences = 'Age Adjusted Incidences of Melanoma per 100,000';
      datalines ;
         0.9 0.8 0.8 1.3 1.4 1.2 1.7 1.8 1.6 1.5
         1.5 2.0 2.5 2.7 2.9 2.5 3.1 2.4 2.2 2.9
         2.5 2.6 3.2 3.8 4.2 3.9 3.7 3.3 3.7 3.9
         4.1 3.8 4.7 4.4 4.8 4.8 4.8
         ;
   run ;



    proc gplot data = melanoma ;
       plot Incidences*year / cframe = ligr vaxis = axis1 haxis = axis2 ;
       title 'Melanoma Incidences Plot' ;
       symbol c = blue i = join v = dot ;
       axis1 label = (angle=90 'Melanoma Incidences') ;
       axis2 label =('Year') ;
    run ;



   proc ucm data = melanoma;
      id year interval = year;
      model Incidences ;
      irregular ;
      level ;
      slope ;
      cycle ;
   run ;



  ods html ;
  ods graphics on ;
   proc ucm data = melanoma;
      id year interval = year;
      model Incidences ;
      irregular ;
      level variance=0 noest ;
      slope variance=0 noest ;
      cycle plot=smooth ;
      estimate back=5 plot=(normal acf);
      forecast lead=10 back=5 plot=decomp;
   run ;
  ods graphics off ;
  ods html close ;