Courtney Brown, Ph.D.
H O M E
A Brief Biography
Curriculum Vitae
Career Guidance Videos
Political Music Videos
Political Music Articles
R Tutorial Videos
Data Sets and
Computer Programs
Scholarly
Speculative Nonfiction
The Farsight Institute
Book Reviews
Videos
Publicity Photos
Speaking Requests
Farsight Prime
African Television
Music Videos

C O N T A C T
Follow on Facebook Courtney Brown
Follow on FB
Follow on Twitter Courtney Brown
Follow on Twitter
Courtney Brown on Instagram

 


OPTIONS NONOTES NOCENTER;                                                       
TITLE 'SOUTHERN WHITE CONDITIONED, 1964-84';                                    
                                                                                
PROC MEANS DATA=POLICENS.WBLA5084;                                              
                                                                                
                                                                                
PROC IML;                                                                       
 RESET;                                                                         
    USE POLICENS.WBLA5084;                                                      
    READ ALL INTO  TTT(|  COLNAME=VARNAME |);                                   
CD50=TTT(|,1|); CD52=TTT(|,2|); CD54=TTT(|,3|); CD56=TTT(|,4|);                 
CD58=TTT(|,5|); CD60=TTT(|,6|); CD62=TTT(|,7|); CD64=TTT(|,8|);                 
CD66=TTT(|,9|); CD68=TTT(|,10|); CD70=TTT(|,11|);                               
CD72=TTT(|,12|); CD74=TTT(|,13|); CD76=TTT(|,14|); CD78=TTT(|,15|);             
CD80=TTT(|,16|); CD82=TTT(|,17|); CR50=TTT(|,18|); CR52=TTT(|,19|);             
CR54=TTT(|,20|); CR56=TTT(|,21|); CR58=TTT(|,22|); CR60=TTT(|,23|);             
CR62=TTT(|,24|); CR64=TTT(|,25|); CR66=TTT(|,26|); CR68=TTT(|,27|);             
CR70=TTT(|,28|); CR72=TTT(|,29|); CR74=TTT(|,30|); CR76=TTT(|,31|);             
CR78=TTT(|,32|); CR80=TTT(|,33|); CR82=TTT(|,34|); CT50=TTT(|,35|);             
CT52=TTT(|,36|); CT54=TTT(|,37|); CT56=TTT(|,38|); CT58=TTT(|,39|);             
CT60=TTT(|,40|); CT62=TTT(|,41|); CT64=TTT(|,42|); CT66=TTT(|,43|);             
CT68=TTT(|,44|); CT70=TTT(|,45|); CT72=TTT(|,46|); CT74=TTT(|,47|);             
CT76=TTT(|,48|); CT78=TTT(|,49|); CT80=TTT(|,50|); CT82=TTT(|,51|);             
PR52=TTT(|,52|); PR56=TTT(|,53|); PR60=TTT(|,54|); PR64=TTT(|,55|);             
PR68=TTT(|,56|); PR72=TTT(|,57|); PR76=TTT(|,58|); PR80=TTT(|,59|);             
PD52=TTT(|,60|); PD56=TTT(|,61|); PD60=TTT(|,62|); PD64=TTT(|,63|);             
PD68=TTT(|,64|); PD72=TTT(|,65|); PD76=TTT(|,66|); PD80=TTT(|,67|);             
PT52=TTT(|,68|); PT56=TTT(|,69|); PT60=TTT(|,70|); PT64=TTT(|,71|);             
PT68=TTT(|,72|); PT72=TTT(|,73|); PT76=TTT(|,74|); PT80=TTT(|,75|);             
PW68=TTT(|,76|); PA80=TTT(|,77|); E1950=TTT(|,78|); E1952=TTT(|,79|);           
E1954=TTT(|,80|); E1956=TTT(|,81|); E1958=TTT(|,82|); E1960=TTT(|,83|);         
E1962=TTT(|,84|); E1964=TTT(|,85|); E1966=TTT(|,86|); E1968=TTT(|,87|);         
E1970=TTT(|,88|); E1972=TTT(|,89|); E1974=TTT(|,90|); E1976=TTT(|,91|);         
E1978=TTT(|,92|); E1980=TTT(|,93|); E1982=TTT(|,94|); URBAN=TTT(|,95|);         
FARMDENS=TTT(|,96|);NORTH=TTT(|,97|);SOUTH=TTT(|,98|);COUNTY=TTT(|,99|);        
STATE=TTT(|,100|);CD84=TTT(|,101|);CR84=TTT(|,102|);CT84=TTT(|,103|);           
PD84=TTT(|,104|);PR84=TTT(|,105|);PT84=TTT(|,106|);E1984=TTT(|,107|);           
BLACK=TTT(|,108|);WHITE=TTT(|,109|);SOUTBLAK=TTT(|,110|);                       
SOUTWHIT=TTT(|,111|);NORTBLAK=TTT(|,112|);NORTWHIT=TTT(|,113|);                 
FREE TTT;                                                                       
                                                                                
CASES = NROW(COUNTY);                                                           
***************************************************************;                
START PRIMO;                                                                    
***************************************************************;                
GOTO PERIOD2;                                                                   
                                                                                
ELIGAVE=  (E1950+E1952+E1954+E1956+E1958+E1960+E1962+E1964+E1966+               
            E1968+E1970+E1972+E1974+E1976+E1978+E1980+E1982+E1984);             
ELIGTOT=SUM(ELIGAVE);                                                           
WEIGHT=ELIGAVE/ELIGTOT;                                                         
CDM=  (CD50+CD52+CD54+CD56+CD58+CD60+CD62+CD64+CD66+CD68+CD70+                  
            CD72+CD74+CD76+CD78+CD80+CD82+CD84)/18;                             
CRM=  (CR50+CR52+CR54+CR56+CR58+CR60+CR62+CR64+CR66+CR68+CR70+                  
            CR72+CR74+CR76+CR78+CR80+CR82+CR84)/18;                             
PRM=  (PR52+PR56+PR60+PR64+PR68+PR72+PR76+PR80+PR84)/9;                         
PDM=  (PD52+PD56+PD60+PD64+PD68+PD72+PD76+PD80+PD84)/9;                         
CDMEAN=(CDM#ELIGAVE);CDMEAN=SUM(CDMEAN);                                        
CRMEAN=(CRM#ELIGAVE);CRMEAN=SUM(CRMEAN);                                        
FREE CDM CRM;                                                                   
CDMEAN=CDMEAN/ELIGTOT;                                                          
CRMEAN=CRMEAN/ELIGTOT;                                                          
CDDEV=(((CD50-CD52)##2)+((CD52-CD54)##2)                                        
   +((CD54-CD56)##2)+((CD56-CD58)##2)                                           
   +((CD58-CD60)##2)+((CD60-CD62)##2)+((CD62-CD64)##2)+((CD64-CD66)##2)         
   +((CD66-CD68)##2)+((CD68-CD70)##2)+((CD70-CD72)##2)+((CD72-CD74)##2)         
   +((CD74-CD76)##2)+((CD76-CD78)##2)+((CD78-CD80)##2)+((CD80-CD82)##2)         
   +((CD82-CD84)##2));                                                          
CRDEV=(((CR50-CR52)##2)+((CR52-CR54)##2)                                        
   +((CR54-CR56)##2)+((CR56-CR58)##2)                                           
   +((CR58-CR60)##2)+((CR60-CR62)##2)+((CR62-CR64)##2)+((CR64-CR66)##2)         
   +((CR66-CR68)##2)+((CR68-CR70)##2)+((CR70-CR72)##2)+((CR72-CR74)##2)         
   +((CR74-CR76)##2)+((CR76-CR78)##2)+((CR78-CR80)##2)+((CR80-CR82)##2)         
   +((CR82-CR84)##2));                                                          
CDDEV=(CDDEV#ELIGAVE);CDDEVSUM=SUM(CDDEV);                                      
CRDEV=(CRDEV#ELIGAVE);CRDEVSUM=SUM(CRDEV);                                      
FREE CDDEV CRDEV;                                                               
CDALL1=CD50||(CD52||(CD54||(CD56||(CD58||(CD60||(CD62||CD64))))));              
CDALL2=CDALL1||(CD66||(CD68||(CD70||(CD72||(CD74||(CD76||CD78))))));            
CDALL3=CDALL2||(CD80||(CD82||CD84));                                            
CRALL1=CR50||(CR52||(CR54||(CR56||(CR58||(CR60||(CR62||CR64))))));              
CRALL2=CRALL1||(CR66||(CR68||(CR70||(CR72||(CR74||(CR76||CR78))))));            
CRALL3=CRALL2||(CR80||(CR82||CR84));                                            
CDALL3A=CDALL3#ELIGAVE;                                                         
CDALL=(CDALL3A(|+,|))/ELIGTOT;                                                  
CRALL3A=CRALL3#ELIGAVE;                                                         
CRALL=(CRALL3A(|+,|))/ELIGTOT;                                                  
CDALL=CDALL`;CRALL=CRALL`;CREPDEM=CRALL||CDALL;                                 
FREE CDALL1 CDALL2 CDALL3 CRALL1 CRALL2 CRALL3 CDALL CRALL;                     
PRINT 'THIS IS THE COMBINED SECTION FOR ALL YEARS';                             
PRINT CASES CRMEAN CDMEAN, CREPDEM;                                             
                                                                                
************************************************************;                   
                                                                                
PERIOD1:                                                                        
PERIOD=1;                                                                       
ELIGAVE=  (E1950+E1952+E1954+E1956+E1958+E1960+E1962+E1964);                    
ELIGTOT=SUM(ELIGAVE);                                                           
WEIGHT=ELIGAVE/ELIGTOT;                                                         
CDM=  (CD50+CD52+CD54+CD56+CD58+CD60+CD62+CD64)/8;                              
CRM=  (CR50+CR52+CR54+CR56+CR58+CR60+CR62+CR64)/8;                              
PRM=  (PR52+PR56+PR60+PR64)/4;                                                  
PDM=  (PD52+PD56+PD60+PD64)/4;                                                  
CDMEAN=(CDM#ELIGAVE);CDMEAN=SUM(CDMEAN);                                        
CRMEAN=(CRM#ELIGAVE);CRMEAN=SUM(CRMEAN);                                        
FREE CDM CRM;                                                                   
CDMEAN=CDMEAN/ELIGTOT;                                                          
CRMEAN=CRMEAN/ELIGTOT;                                                          
CDDEV=(((CD50-CD52)##2)+((CD52-CD54)##2)                                        
   +((CD54-CD56)##2)+((CD56-CD58)##2)                                           
   +((CD58-CD60)##2)+((CD60-CD62)##2)+((CD62-CD64)##2));                        
CRDEV=(((CR50-CR52)##2)+((CR52-CR54)##2)                                        
   +((CR54-CR56)##2)+((CR56-CR58)##2)                                           
   +((CR58-CR60)##2)+((CR60-CR62)##2)+((CR62-CR64)##2));                        
CDDEV=(CDDEV#ELIGAVE);CDDEVSUM=SUM(CDDEV);                                      
CRDEV=(CRDEV#ELIGAVE);CRDEVSUM=SUM(CRDEV);                                      
FREE CDDEV CRDEV;                                                               
CDALL3=CD50||(CD52||(CD54||(CD56||(CD58||(CD60||(CD62||CD64))))));              
CRALL3=CR50||(CR52||(CR54||(CR56||(CR58||(CR60||(CR62||CR64))))));              
CDALL3A=CDALL3#ELIGAVE;                                                         
CDALL=(CDALL3A(|+,|))/ELIGTOT;                                                  
CRALL3A=CRALL3#ELIGAVE;                                                         
CRALL=(CRALL3A(|+,|))/ELIGTOT;                                                  
CDALL=CDALL`;CRALL=CRALL`;CREPDEM=CRALL||CDALL;                                 
FREE CDALL3 CRALL3 CDALL CRALL;                                                 
PRINT 'THIS IS THE SECTION FOR THE 1950-64 YEARS';                              
PRINT CASES CRMEAN CDMEAN, CREPDEM;                                             
**************************************************************;                 
                                                                                
GOTO SKIP3;                                                                     
                                                                                
PERIOD2:                                                                        
PERIOD=2;                                                                       
ELIGAVE=  (E1962+E1964+E1966+                                                   
            E1968+E1970+E1972+E1974+E1976+E1978+E1980+E1982+E1984);             
ELIGTOT=SUM(ELIGAVE);                                                           
WEIGHT=ELIGAVE/ELIGTOT;                                                         
CDM=  (CD62+CD64+CD66+CD68+CD70+                                                
            CD72+CD74+CD76+CD78+CD80+CD82+CD84)/12;                             
CRM=  (CR62+CR64+CR66+CR68+CR70+                                                
            CR72+CR74+CR76+CR78+CR80+CR82+CR84)/12;                             
PRM=  (PR64+PR68+PR72+PR76+PR80+PR84)/6;                                        
PDM=  (PD64+PD68+PD72+PD76+PD80+PD84)/6;                                        
CDMEAN=(CDM#ELIGAVE);CDMEAN=SUM(CDMEAN);                                        
CRMEAN=(CRM#ELIGAVE);CRMEAN=SUM(CRMEAN);                                        
FREE CDM CRM;                                                                   
CDMEAN=CDMEAN/ELIGTOT;                                                          
CRMEAN=CRMEAN/ELIGTOT;                                                          
CDDEV=(((CD62-CD64)##2)+((CD64-CD66)##2)                                        
   +((CD66-CD68)##2)+((CD68-CD70)##2)+((CD70-CD72)##2)+((CD72-CD74)##2)         
   +((CD74-CD76)##2)+((CD76-CD78)##2)+((CD78-CD80)##2)+((CD80-CD82)##2)         
   +((CD82-CD84)##2));                                                          
CRDEV=(((CR62-CR64)##2)+((CR64-CR66)##2)                                        
   +((CR66-CR68)##2)+((CR68-CR70)##2)+((CR70-CR72)##2)+((CR72-CR74)##2)         
   +((CR74-CR76)##2)+((CR76-CR78)##2)+((CR78-CR80)##2)+((CR80-CR82)##2)         
   +((CR82-CR84)##2));                                                          
CDDEV=(CDDEV#ELIGAVE);CDDEVSUM=SUM(CDDEV);                                      
CRDEV=(CRDEV#ELIGAVE);CRDEVSUM=SUM(CRDEV);                                      
FREE CDDEV CRDEV;                                                               
CDALL2=CD62||(CD64||(CD66||(CD68||(CD70||(CD72||(CD74||CD76))))));              
CDALL3=CDALL2||(CD78||(CD80||(CD82||CD84)));                                    
CRALL2=CR62||(CR64||(CR66||(CR68||(CR70||(CR72||(CR74||CR76))))));              
CRALL3=CRALL2||(CR78||(CR80||(CR82||CR84)));                                    
CDALL3A=CDALL3#ELIGAVE;                                                         
CDALL=(CDALL3A(|+,|))/ELIGTOT;                                                  
CRALL3A=CRALL3#ELIGAVE;                                                         
CRALL=(CRALL3A(|+,|))/ELIGTOT;                                                  
CDALL=CDALL`;CRALL=CRALL`;CREPDEM=CRALL||CDALL;                                 
FREE CDALL2 CDALL3 CRALL2 CRALL3 CDALL CRALL;                                   
PRINT 'THIS IS THE SECTION FOR THE 1964-84 YEARS';                              
PRINT CASES CRMEAN CDMEAN, CREPDEM;                                             
                                                                                
SKIP3:                                                                          
                                                                                
*******************************************************;                        
FINISH;RUN PRIMO;                                                               
*******************************************************;                        
*STOP;                                                                          
                                                                                
START;                                                                          
    DO C44 =  6  TO  6 ;                                                        
       IF C44 =  1  THEN DO;                                                    
          PRINT 'URBAN' 'URBAN' 'URBAN' 'URBAN' 'URBAN';                        
          PRINT 'URBAN' 'URBAN' 'URBAN' 'URBAN' 'URBAN';                        
          PRINT 'URBAN' 'URBAN' 'URBAN' 'URBAN' 'URBAN';                        
          PRINT 'URBAN' 'URBAN' 'URBAN' 'URBAN' 'URBAN';                        
          D1 = URBAN;                                                           
          URBMEAN=URBAN(|+,|);URBMEAN=URBMEAN/CASES;                            
          PRINT URBMEAN;                                                        
          END;                                                                  
       IF C44 =  2  THEN DO;                                                    
          PRINT 'FARMDENS' 'FARMDENS' 'FARMDENS' 'FARMDENS';                    
          PRINT 'FARMDENS' 'FARMDENS' 'FARMDENS' 'FARMDENS';                    
          PRINT 'FARMDENS' 'FARMDENS' 'FARMDENS' 'FARMDENS';                    
          PRINT 'FARMDENS' 'FARMDENS' 'FARMDENS' 'FARMDENS';                    
          D1 = FARMDENS;                                                        
          FARMMEAN=FARMDENS(|+,|);FARMMEAN=FARMMEAN/CASES;                      
          PRINT FARMMEAN;                                                       
          END;                                                                  
       IF C44 =  3  THEN DO;                                                    
          PRINT 'SOUTH' 'SOUTH' 'SOUTH' 'SOUTH';                                
          PRINT 'SOUTH' 'SOUTH' 'SOUTH' 'SOUTH';                                
          PRINT 'SOUTH' 'SOUTH' 'SOUTH' 'SOUTH';                                
          PRINT 'SOUTH' 'SOUTH' 'SOUTH' 'SOUTH';                                
          D1 = SOUTH;                                                           
          SOUTMEAN=SOUTH(|+,|);SOUTMEAN=SOUTMEAN/CASES;                         
          PRINT SOUTMEAN;                                                       
          END;                                                                  
       IF C44 =  4  THEN DO;                                                    
          PRINT 'NORTH' 'NORTH' 'NORTH' 'NORTH';                                
          PRINT 'NORTH' 'NORTH' 'NORTH' 'NORTH';                                
          PRINT 'NORTH' 'NORTH' 'NORTH' 'NORTH';                                
          PRINT 'NORTH' 'NORTH' 'NORTH' 'NORTH';                                
          D1 = NORTH;                                                           
          NORTMEAN=NORTH(|+,|);NORTMEAN=NORTMEAN/CASES;                         
          PRINT NORTMEAN;                                                       
          END;                                                                  
       IF C44 =  5  THEN DO;                                                    
          PRINT 'SOUTHERN BLACK';                                               
          PRINT 'SOUTHERN BLACK';                                               
          PRINT 'SOUTHERN BLACK';                                               
          PRINT 'SOUTHERN BLACK';                                               
          D1 = SOUTBLAK;                                                        
          SBMEAN=SOUTBLAK(|+,|);SBMEAN=SBMEAN/CASES;                            
          PRINT SBMEAN;                                                         
          END;                                                                  
       IF C44 =  6  THEN DO;                                                    
          PRINT 'SOUTHERN WHITE';                                               
          PRINT 'SOUTHERN WHITE';                                               
          PRINT 'SOUTHERN WHITE';                                               
          PRINT 'SOUTHERN WHITE';                                               
          D1 = SOUTWHIT;                                                        
          SWMEAN=SOUTWHIT(|+,|);SWMEAN=SWMEAN/CASES;                            
          PRINT SWMEAN;                                                         
          END;                                                                  
       IF C44 =  7  THEN DO;                                                    
          PRINT 'NORTHERN BLACK';                                               
          PRINT 'NORTHERN BLACK';                                               
          PRINT 'NORTHERN BLACK';                                               
          PRINT 'NORTHERN BLACK';                                               
          D1 = NORTBLAK;                                                        
          NBMEAN=NORTBLAK(|+,|);NBMEAN=NBMEAN/CASES;                            
          PRINT NBMEAN;                                                         
          END;                                                                  
       IF C44 =  8  THEN DO;                                                    
          PRINT 'NORTHERN WHITE';                                               
          PRINT 'NORTHERN WHITE';                                               
          PRINT 'NORTHERN WHITE';                                               
          PRINT 'NORTHERN WHITE';                                               
          D1 = NORTWHIT;                                                        
          NWMEAN=NORTWHIT(|+,|);NWMEAN=NWMEAN/CASES;                            
          PRINT NWMEAN;                                                         
          END;                                                                  
*****************************************************;                          
    FF=   0.05047;                                                              
    BB=   0.00311;                                                              
    MM=   0.40773;                                                              
    AA=   0.37938;                                                              
    GG=   0.23549;                                                              
    QQ=   0.55073;                                                              
    SS=   0.32154;                                                              
    WW=   0.22807;                                                              
    VV=   0.02023;                                                              
    KK=   0.02810;                                                              
    JJ=   0.10928;                                                              
    YY=  -0.00490;                                                              
    DD=  -0.01352;                                                              
    XX=   0.04954;                                                              
    TT=   0.00000;                                                              
    PP=   0.00000;                                                              
    EE=   0.00000;                                                              
    UU=   0.00000;                                                              
    ZZ=   0.00000;                                                              
  LIMLIM= 1.00000;                                                              
IF PERIOD=2 THEN DO;                                                            
YY=0;XX=0;END;                                                                  
*****************************************************;                          
       Y99 = 1;                                                                 
       I =  0.000001 ;                                                          
       H =  0.1 ;                                                               
       Z1 = {0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1                            
             0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.0001};                       
       Z1 = Z1 / 100;                                                           
       F =  0 ;B =  0 ;M =  0 ;A =  0 ;G =  0 ;Q =  0 ;                         
       S =  0 ;W =  0 ;V =  0 ;K =  0 ;J =  0 ;Y =  0 ;                         
       D =  0 ;X =  0 ;T =  0 ;P =  0 ;E =  0 ;U =  0 ;                         
       Z =  0 ;                                                                 
       LIM =  0 ;                                                               
       TESTLIST=0;                                                              
       ITCOUNT =  0 ;                                                           
       TE = 0 ;                                                                 
       TE2=0;                                                                   
       TIMEUP=0;                                                                
       E1 =  0 ;                                                                
       DP1 =  1 ;                                                               
       D2 =  1 ;                                                                
       D3 =  0 ;                                                                
**********************************************************;                     
*****   IF D3=1 YOU GET THE UNCONDITIONAL MODEL    *******;                     
IF D3 =  1  THEN DO;                                                            
     D1 =  1 ;                                                                  
     D2 =  0 ;                                                                  
     F = FF;B = BB;M = MM;A = AA;G = GG;Q = QQ;                                 
     S = SS;W = WW;V = VV;K = KK;J = JJ;Y = YY;                                 
     D = DD;X = XX;T = TT;P = PP;E = EE;U = UU;                                 
     Z = ZZ;LIM = LIMLIM;                                                       
      FF =  0 ;BB =  0 ;MM =  0 ;AA =  0 ;GG =  0 ;QQ =  0 ;                    
      SS =  0 ;WW =  0 ;VV =  0 ;KK =  0 ;JJ =  0 ;YY =  0 ;                    
      DD =  0 ;XX =  0 ;TT =  0 ;PP =  0 ;EE =  0 ;UU =  0 ;                    
      ZZ =  0 ;                                                                 
      LIMLIM =  0 ;                                                             
          END;                                                                  
**********************************************************;                     
GOTO ESTIMATE;                                                                  
**********************************************************;                     
MODELFIT:                                                                       
       IF DP1 =  1  THEN DO;                                                    
          PRINT 'MODELFIT' 'BEGINNING';                                         
          END;                                                                  
DO U1 =  7  TO  17 ;                                                            
*F   B   M   A   G   Q   S   W   V   K                                          
        J   Y   D   X   T   P   E   U   Z   LIM ;                               
IF U1=1 THEN DO;                                                                
    CPCGNP=0.11648  ;ECOINC=1;                                                  
    PD=PD52;PR=PR52;ON=1;DINC=0;RINC=0;                                         
    CD1=CD50;CD2=CD52;CR1=CR50;CR2=CR52;PRESDIF=PD52-PR52;                      
    TIMEUP=0;TIMEON=1;END;                                                      
IF U1=2 THEN DO;                                                                
    CPCGNP=-0.05661 ;ECOINC=-1;                                                 
    PD=0;PR=0;      ON=0;DINC=0;RINC=1;                                         
    CD1=CD52;CD2=CD54;CR1=CR52;CR2=CR54;PRESDIF=0;TIMEON=0;END;                 
IF U1=3 THEN DO;                                                                
    CPCGNP=0.07751  ;ECOINC=-1;                                                 
    PD=PD56;PR=PR56;ON=1;DINC=0;RINC=0;                                         
    CD1=CD54;CD2=CD56;CR1=CR54;CR2=CR56;PRESDIF=PD56-PR56;END;                  
IF U1=4 THEN DO;                                                                
    CPCGNP=-0.04887 ;ECOINC=-1;                                                 
    PD=0;PR=0;      ON=0;DINC=0;RINC=1;                                         
    CD1=CD56;CD2=CD58;CR1=CR56;CR2=CR58;PRESDIF=0;END;                          
IF U1=5 THEN DO;                                                                
    CPCGNP=0.10840  ;ECOINC=-1;                                                 
    PD=PD60;PR=PR60;ON=1;DINC=0;RINC=0;                                         
    CD1=CD58;CD2=CD60;CR1=CR58;CR2=CR60;PRESDIF=PD60-PR60;END;                  
IF U1=6 THEN DO;                                                                
    CPCGNP=0.29353  ;ECOINC=1;                                                  
    PD=0;PR=0;      ON=0;DINC=1;RINC=0;                                         
    CD1=CD60;CD2=CD62;CR1=CR60;CR2=CR62;PRESDIF=0;END;                          
                                                                                
IF U1=7 THEN DO;                                                                
    CPCGNP=0.26440  ;ECOINC=1;                                                  
    PD=PD64;PR=PR64;ON=1;DINC=0;RINC=0;                                         
    CD1=CD62;CD2=CD64;CR1=CR62;CR2=CR64;PRESDIF=PD64-PR64;                      
    TIMEUP=1;IF PERIOD=2 THEN DO;TIMEON=1;TIMEUP=0;END;END;                     
                                                                                
IF U1=8 THEN DO;                                                                
    CPCGNP=0.34585  ;ECOINC=1;                                                  
    PD=0;PR=0;      ON=0;DINC=1;RINC=0;                                         
    CD1=CD64;CD2=CD66;CR1=CR64;CR2=CR66;PRESDIF=0;TIMEON=0;END;                 
IF U1=9 THEN DO;                                                                
    CPCGNP=0.26145  ;ECOINC=1;                                                  
    PD=PD68;PR=PR68;ON=1;DINC=0;RINC=0;                                         
    CD1=CD66;CD2=CD68;CR1=CR66;CR2=CR68;PRESDIF=PD68-PR68;END;                  
IF U1=10 THEN DO;                                                               
    CPCGNP=-0.02291 ;ECOINC=-1;                                                 
    PD=0;PR=0;      ON=0;DINC=0;RINC=1;                                         
    CD1=CD68;CD2=CD70;CR1=CR68;CR2=CR70;PRESDIF=0;END;                          
IF U1=11 THEN DO;                                                               
    CPCGNP=0.31933  ;ECOINC=-1;                                                 
    PD=PD72;PR=PR72;ON=1;DINC=0;RINC=0;                                         
    CD1=CD70;CD2=CD72;CR1=CR70;CR2=CR72;PRESDIF=PD72-PR72;END;                  
IF U1=12 THEN DO;                                                               
    CPCGNP=-0.06960 ;ECOINC=-1;                                                 
    PD=0;PR=0;      ON=0;DINC=0;RINC=1;                                         
    CD1=CD72;CD2=CD74;CR1=CR72;CR2=CR74;PRESDIF=0;END;                          
IF U1=13 THEN DO;                                                               
    CPCGNP=0.26548  ;ECOINC=-1;                                                 
    PD=PD76;PR=PR76;ON=1;DINC=0;RINC=0;                                         
    CD1=CD74;CD2=CD76;CR1=CR74;CR2=CR76;PRESDIF=PD76-PR76;END;                  
IF U1=14 THEN DO;                                                               
    CPCGNP=0.27882  ;ECOINC=1;                                                  
    PD=0;PR=0;      ON=0;DINC=1;RINC=0;                                         
    CD1=CD76;CD2=CD78;CR1=CR76;CR2=CR78;PRESDIF=0;END;                          
IF U1=15 THEN DO;                                                               
    CPCGNP=-0.24199 ;ECOINC=1;                                                  
    PD=PD80;PR=PR80;ON=1;DINC=0;RINC=0;                                         
    CD1=CD78;CD2=CD80;CR1=CR78;CR2=CR80;PRESDIF=PD80-PR80;END;                  
IF U1=16 THEN DO;                                                               
    CPCGNP=-0.12449 ;ECOINC=-1;                                                 
    PD=0;PR=0;      ON=0;DINC=0;RINC=1;                                         
    CD1=CD80;CD2=CD82;CR1=CR80;CR2=CR82;PRESDIF=0;END;                          
IF U1=17 THEN DO;                                                               
    CPCGNP=0.52647  ;ECOINC=-1;                                                 
    PD=PD84;PR=PR84;ON=1;DINC=0;RINC=0;                                         
    CD1=CD82;CD2=CD84;CR1=CR82;CR2=CR84;PRESDIF=PD84-PR84;TIMEUP=1;END;         
SKIP2:                                                                          
                                                                                
***** THE UNCONDITIONED MODEL **************************;                       
                                                                                
IF D3=1 THEN DO;                                                                
    IF TIMEON=1 THEN DO;                                                        
    CD0=CD1+Y;CR0=CR1+X;PD0=0;PR0=0;END;                                        
                                                                                
     B2 = CD1 - (PD0#(G + (J#DINC) - (K#RINC)));B1=CD0;                         
     DBASE   = F + (M#B2) + (A#B1);                                             
     PREDCD2 = DBASE + (G#PD) + (B#ECOINC#CPCGNP);                              
     CD0=B2;PD0=PD;                                                             
                                                                                
     B5 = CR1 - (PR0#(W + (K#RINC) - (J#DINC)));B4=CR0;                         
     RBASE   = V + (Q#B5) + (S#B4);                                             
     PREDCR2 = RBASE + (W#PR) + (D#ECOINC#CPCGNP);                              
     CR0=B5;PR0=PR;END;                                                         
                                                                                
****** THE CONDITIONED MODEL *************************;                         
                                                                                
IF D3=0 THEN DO;                                                                
    IF TIMEON=1 THEN DO;                                                        
    CD0=CD1+(YY+(D1#Y));CR0=CR1+(XX+(D1#X));PD0=0;PR0=0;END;                    
                                                                                
     B2 = CD1 - (PD0#((GG+(D1#G))                                               
          + ((JJ+(D1#J))#DINC) - ((KK+(D1#K))#RINC)));B1=CD0;                   
     DBASE   = (FF+(D1#F)) + ((MM+(D1#M))#B2) + ((AA+(D1#A))#B1);               
     PREDCD2 = DBASE + ((GG+(D1#G))#PD)                                         
               + ((BB+(D1#B))#ECOINC#CPCGNP);                                   
     CD0=B2;PD0=PD;                                                             
                                                                                
     B5 = CR1 - (PR0#((WW+(D1#W))                                               
          + ((KK+(D1#K))#RINC) - ((JJ+(D1#J))#DINC)));B4=CR0;                   
     RBASE   = (VV+(D1#V)) + ((QQ+(D1#Q))#B5) + ((SS+(D1#S))#B4);               
     PREDCR2 = RBASE + ((WW+(D1#W))#PR)                                         
               + ((DD+(D1#D))#ECOINC#CPCGNP);                                   
     CR0=B5;PR0=PR;END;                                                         
*******************************************************;                        
                                                                                
IF TIMEON=1 THEN DO;                                                            
    CDT1=CD0;  CRT1=CR0;                                                        
    CDT3=(CDT1#ELIGAVE);CDT2=SUM(CDT3);CDT2=CDT2/ELIGTOT;                       
    CRT3=(CRT1#ELIGAVE);CRT2=SUM(CRT3);CRT2=CRT2/ELIGTOT;                       
    FREE CDT3 CRT3; END;                                                        
                                                                                
IF (TE=1 | TE2=1) THEN DO;                                                      
      PTER=ELIGAVE#PREDCR2;                                                     
      PTED=ELIGAVE#PREDCD2;                                                     
    PTALLR1=SUM(PTER);PTALLR=PTALLR1/ELIGTOT;                                   
    PTALLD1=SUM(PTED);PTALLD=PTALLD1/ELIGTOT;                                   
      RBAS=ELIGAVE#RBASE;                                                       
      DBAS=ELIGAVE#DBASE;                                                       
    PRBAS=SUM(RBAS);PRBASE=PRBAS/ELIGTOT;                                       
    PDBAS=SUM(DBAS);PDBASE=PDBAS/ELIGTOT;END;                                   
                                                                                
IF TE2=1 THEN DO;                                                               
    PREDICT3=(PTALLR1||PTALLD1);                                                
    IF TIMEON=1 THEN DO;PREDICT4={0 0};END;                                     
    PREDICT4=PREDICT4//PREDICT3;                                                
    IF TIMEUP=1 THEN DO;                                                        
    PREDIC=PREDICT4(|+,|);END;                                                  
    END;                                                                        
                                                                                
IF TE=1 THEN DO;                                                                
    PALL=(PTALLR||PTALLD);PBASE=(PRBASE||PDBASE);                               
    IF TIMEON=1 THEN DO;PTRAJECT= CRT2||CDT2 ;CONGBASE= PTRAJECT;END;           
    PTRAJECT=PTRAJECT//PALL;CONGBASE=CONGBASE//PBASE;                           
IF TIMEUP = 1 THEN DO;                                                          
    PRINT CREPDEM PTRAJECT;END;                                                 
  END;                                                                          
                                                                                
LINK COMPILE1;                                                                  
END;                                                                            
LINK RSQ;                                                                       
       IF DP1 =  1  THEN DO;                                                    
          PRINT 'MODELFIT' 'ENDING';                                            
          END;                                                                  
  RETURN;                                                                       
***********************************************************;                    
COMPILE1:                                                                       
      IF TIMEON=1 THEN DO;                                                      
      RESIDCD=0#CD2;RESIDCR=0#CR2;END;                                          
    RESCD=((CD2-PREDCD2)##2);RESIDCD=RESIDCD+RESCD;                             
    RESCR=((CR2-PREDCR2)##2);RESIDCR=RESIDCR+RESCR;                             
  RETURN;                                                                       
***********************************************************;                    
***********************************************************;                    
 RSQ:  RESIDCR = ( ELIGAVE # ( RESIDCR ));                                      
       RESIDR = SUM(RESIDCR);                                                   
       RESIDCD = ( ELIGAVE # ( RESIDCD ));                                      
       RESIDD = SUM(RESIDCD);                                                   
       RRSQUARE =  1  - ( RESIDR / CRDEVSUM );                                  
       DRSQUARE =  1  - ( RESIDD / CDDEVSUM );                                  
       RSQUARE = ( RRSQUARE  + DRSQUARE ) /  2 ;                                
       IF DP1 =  1  THEN DO;                                                    
        PRINT 'RRSQUARE' 'DRSQUARE' 'RSQUARE';                                  
        RSQFITS=RRSQUARE||(DRSQUARE||RSQUARE);                                  
          PRINT , RSQFITS;                                                      
          END;                                                                  
       RETURN;                                                                  
**************************************************************;                 
 BESTPAR:                                                                       
       BESTF = F;BESTB = B;BESTM = M;BESTA = A;BESTG = G;                       
       BESTQ = Q;BESTS = S;BESTW = W;BESTV = V;BESTK = K;                       
       BESTJ = J;BESTY = Y;BESTD = D;BESTX = X;BESTT = T;                       
       BESTP = P;BESTE = E;BESTU = U;BESTZ = Z;BESTLIM = LIM;                   
       BESTRSQ = RSQUARE;                                                       
       BESTRRSQ = RRSQUARE;                                                     
       BESTDRSQ = DRSQUARE;                                                     
 PMS1=F||(B||(M||(A||(G||(Q||(S||(W||V)))))));                                  
 PMS2 = K||(J||(Y||(D||(X||T))));                                               
 PMS3 = P||(E||(U||(Z||LIM)));                                                  
       PARMS = (PMS1||(PMS2||PMS3));                                            
       IF DP1 =  1  THEN DO;                                                    
  PRINT 'F' 'B' 'M' 'A' 'G' 'Q' 'S' 'W' 'V' 'K' 'J' 'Y' 'D' 'X' 'T' 'P'         
        'E' 'U' 'Z' 'LIM';                                                      
          PRINT , PARMS;                                                        
          END;                                                                  
       RETURN;                                                                  
********************************************************;                       
 SURFACE:                                                                       
*      DP1 =  0 ;                                                               
       PRINT 'SURFACE' 'BEGINNING';                                             
       PRINT 'SURFACE' 'BEGINNING';                                             
*      PRINT 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';                       
       F = F - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       F = F + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DFFIT = ( DRSQUARE - FIT3 );                                             
       F = F - I;                                                               
*      PRINT 'MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM';                     
       M = M - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       M = M + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DMFIT = ( DRSQUARE - FIT3 );                                             
       M = M - I;                                                               
*      PRINT 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';                     
       A = A - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       A = A + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DAFIT=(DRSQUARE-FIT3);                                                   
       A = A - I;                                                               
*      PRINT 'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG';                  
       G = G - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       G = G + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DGFIT = ( DRSQUARE - FIT3 );                                             
       G = G - I;                                                               
*      PRINT 'QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ';                  
       Q = Q - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       Q = Q + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DQFIT = ( RRSQUARE - FIT2 );                                             
       Q = Q - I;                                                               
*      PRINT 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS';                    
       S = S - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       S = S + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DSFIT = ( RRSQUARE - FIT2 );                                             
       S = S - I;                                                               
*      PRINT 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW';                     
       W = W - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       W = W + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DWFIT=(RRSQUARE-FIT2);                                                   
       W = W - I;                                                               
*      PRINT 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV';                    
       V = V - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       V = V + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DVFIT=(RRSQUARE-FIT2);                                                   
       V = V - I;                                                               
*      PRINT 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY';                        
       Y = Y - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       Y = Y + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DYFIT = DRSQUARE - FIT3;                                                 
       Y = Y - I;                                                               
*      PRINT 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';                        
       X = X - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       X = X + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DXFIT = RRSQUARE - FIT2;                                                 
       X = X - I;                                                               
*      PRINT 'JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ';                    
       J = J - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       J = J + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DJFIT=((DRSQUARE+RRSQUARE)/2) - ((FIT3+FIT2)/2);                         
       J = J - I;                                                               
*      PRINT 'KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK';                        
       K = K - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       K = K + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DKFIT=((DRSQUARE+RRSQUARE)/2) - ((FIT3+FIT2)/2);                         
       K = K - I;                                                               
*      PRINT 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB';                        
       B = B - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       B = B + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DBFIT = DRSQUARE - FIT3;                                                 
       B = B - I;                                                               
*      PRINT 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD';                        
       D = D - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       D = D + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DDFIT= RRSQUARE - FIT2;                                                  
       D = D - I;                                                               
GOTO SKIP1;                                                                     
       PRINT 'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT';                        
       T = T - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       T = T + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DTFIT = DRSQUARE - FIT3;                                                 
       T = T - I;                                                               
       PRINT 'PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP';                        
       P = P - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       P = P + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DPFIT = RRSQUARE - FIT2;                                                 
       P = P - I;                                                               
       PRINT 'EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE';                        
       E = E - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       E = E + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DEFIT = LRSQUARE - FIT3;                                                 
       E = E - I;                                                               
       PRINT 'UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU';                        
       U = U - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       U = U + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DUFIT = LRSQUARE - FIT3;                                                 
       U = U - I;                                                               
       PRINT 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ';                        
       Z = Z - I;                                                               
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       Z = Z + (  2  # I );                                                     
       LINK MODELFIT;                                                           
       DZFIT=((LRSQUARE+NRSQUARE)/2)-((FIT3+FIT5)/2);                           
       Z = Z - I;                                                               
       PRINT 'LIMLIMLIMLIMLIMLIMLIMLIMLIMLIMLIMLIMLIM';                         
       LIM = LIM - I;                                                           
       LINK MODELFIT;                                                           
       LINK PUTFIT;                                                             
       LIM = LIM + (  2  # I );                                                 
       LINK MODELFIT;                                                           
       DLIMFIT = NRSQUARE - FIT5;                                               
       LIM = LIM - I;                                                           
                                                                                
SKIP1:                                                                          
DTFIT=0;DPFIT=0;DEFIT=0;DUFIT=0;                                                
DZFIT=0;DLIMFIT=0;                                                              
       PMT1=DFFIT||(DBFIT||(DMFIT||(DAFIT||(DGFIT||(DQFIT||DSFIT)))));          
       PMT2=DWFIT||(DVFIT||(DKFIT||(DJFIT||(DYFIT||(DDFIT||DXFIT)))));          
       PMT3=DTFIT||(DPFIT||(DEFIT||(DUFIT||(DZFIT||DLIMFIT))));                 
       PARMFIT = (PMT1||(PMT2||PMT3));                                          
       PARTIALS = PARMFIT / (  2  # I );                                        
       TEST = SSQ( PARTIALS);                                                   
       TESTLIST=(TESTLIST//TEST);                                               
       PRM1=F||(B||(M||(A||(G||(Q||S)))));                                      
       PRM2=W||(V||(K||(J||(Y||(D||X)))));                                      
       PRM3=T||(P||(E||(U||(Z||LIM))));                                         
       PARM = (PRM1||(PRM2||PRM3));                                             
       PRINT 'F' 'B' 'M' 'A' 'G' 'Q' 'S' 'W' 'V' 'K'                            
       'J' 'Y' 'D' 'X' 'T' 'P' 'E' 'U' 'Z' 'LIM';                               
       PRINT , PARM , PARTIALS;                                                 
       LINK MODELFIT;                                                           
       PRINT 'RRSQUARE' 'DRSQUARE' 'RSQUARE';                                   
       RSQFITS=RRSQUARE||(DRSQUARE||RSQUARE);                                   
       PRINT , RSQFITS;                                                         
       PRINT 'SURFACE' 'ENDING';                                                
       DP1 =  0 ;                                                               
       RETURN;                                                                  
 PUTFIT:                                                                        
       FIT1 = RSQUARE;                                                          
       FIT2 = RRSQUARE;                                                         
       FIT3 = DRSQUARE;                                                         
       RETURN;                                                                  
 PUTPRED:                                                                       
       PREDIC1 = PREDIC;                                                        
       RETURN;                                                                  
 CSFITS:                                                                        
       CHSQALL1 = ( ( PREDIC1 - PREDIC ) ## 2 ) / PREDIC1;                      
       CHSQALL = SUM( CHSQALL1);                                                
       RETURN;                                                                  
 ESTIMATE:                                                                      
       DP1 = 1;TE = 1;E1 = 1;                                                   
       LINK MODELFIT;TE = 0;E1 = 0;                                             
* GOTO CHISQUAR;                                                                
* GOTO TATA;                                                                    
       LINK BESTPAR;                                                            
       DP1 =  0 ;                                                               
       DO Y99 =  1  TO  100;                                                    
          Z2 = Z1;                                                              
          ZCOUNT =  0 ;                                                         
          ITCOUNT =  0 ;                                                        
          LINK SURFACE;                                                         
          PRINT 'ESTIMATE' 'BEGINNING';                                         
          E1 =  1 ;                                                             
          LINK MODELFIT;                                                        
          E1 =  0 ;                                                             
 BEGIN:                                                                         
          FIT1 = RSQUARE;                                                       
          NEWPARM = PARM + ( PARTIALS # Z2 );                                   
          F = NEWPARM(|  1  ,  1 |);                                            
          B = NEWPARM(|  1  ,  2 |);                                            
          M = NEWPARM(|  1  ,  3 |);                                            
          A = NEWPARM(|  1  ,  4 |);                                            
          G = NEWPARM(|  1  ,  5 |);                                            
          Q = NEWPARM(|  1  ,  6 |);                                            
          S = NEWPARM(|  1  ,  7 |);                                            
          W = NEWPARM(|  1  ,  8 |);                                            
          V = NEWPARM(|  1  ,  9 |);                                            
          K = NEWPARM(|  1  ,  10 |);                                           
          J = NEWPARM(|  1  ,  11 |);                                           
          Y = NEWPARM(|  1  ,  12 |);                                           
          D = NEWPARM(|  1  ,  13 |);                                           
          X = NEWPARM(|  1  ,  14 |);                                           
          T = NEWPARM(|  1  ,  15 |);                                           
          P = NEWPARM(|  1  ,  16 |);                                           
          E = NEWPARM(|  1  ,  17 |);                                           
          U = NEWPARM(|  1  ,  18 |);                                           
          Z = NEWPARM(|  1  ,  19 |);                                           
          LIM = NEWPARM(|  1  ,  20 |);                                         
          LINK MODELFIT;                                                        
          IF RSQUARE > FIT1 THEN DO;                                            
             LINK BESTPAR;                                                      
             PARM = NEWPARM;                                                    
             END;                                                               
          ITCOUNT = ITCOUNT +  1 ;                                              
          IF RSQUARE > FIT1 THEN GOTO BEGIN;                                    
          PRINT , ITCOUNT;                                                      
          ITCOUNT =  0 ;                                                        
          ZCOUNT = ZCOUNT +  1 ;                                                
          PRINT , ZCOUNT;                                                       
          Z2 = Z2 /  10 ;                                                       
          IF ZCOUNT >  4  THEN GOTO JUMP1;                                      
          F = BESTF;                                                            
          B = BESTB;                                                            
          M = BESTM;                                                            
          A = BESTA;                                                            
          G = BESTG;                                                            
          Q = BESTQ;                                                            
          S = BESTS;                                                            
          W = BESTW;                                                            
          V = BESTV;                                                            
          K = BESTK;                                                            
          J = BESTJ;                                                            
          Y = BESTY;                                                            
          D = BESTD;                                                            
          X = BESTX;                                                            
          T = BESTT;                                                            
          P = BESTP;                                                            
          E = BESTE;                                                            
          U = BESTU;                                                            
          Z = BESTZ;                                                            
          LIM = BESTLIM;                                                        
          GOTO BEGIN;                                                           
 JUMP1:                                                                         
          F = BESTF;                                                            
          B = BESTB;                                                            
          M = BESTM;                                                            
          A = BESTA;                                                            
          G = BESTG;                                                            
          Q = BESTQ;                                                            
          S = BESTS;                                                            
          W = BESTW;                                                            
          V = BESTV;                                                            
          K = BESTK;                                                            
          J = BESTJ;                                                            
          Y = BESTY;                                                            
          D = BESTD;                                                            
          X = BESTX;                                                            
          T = BESTT;                                                            
          P = BESTP;                                                            
          E = BESTE;                                                            
          U = BESTU;                                                            
          Z = BESTZ;                                                            
          LIM = BESTLIM;                                                        
          END;                                                                  
       PRINT 'ESTIMATE' 'ENDING';                                               
TE = 1 ;LINK MODELFIT;TE = 0;                                                   
       GOTO CHISQUAR;                                                           
*********************************************************;                      
 CHISQUAR:                                                                      
 TE2=1;                                                                         
       CSF = F;LINK MODELFIT;LINK PUTPRED;                                      
       F =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQF = CHSQALL;F = CSF;                                                
*********************************************************;                      
       CSB = B;LINK MODELFIT;LINK PUTPRED;                                      
       B =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQB = CHSQALL;B = CSB;                                                
*********************************************************;                      
       CSM = M;LINK MODELFIT;LINK PUTPRED;                                      
       M =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQM = CHSQALL;M = CSM;                                                
*********************************************************;                      
       CSA = A;LINK MODELFIT;LINK PUTPRED;                                      
       A =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQA = CHSQALL;A = CSA;                                                
*********************************************************;                      
       CSG = G;LINK MODELFIT;LINK PUTPRED;                                      
       G =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQG = CHSQALL;G = CSG;                                                
*********************************************************;                      
       CSQ = Q;LINK MODELFIT;LINK PUTPRED;                                      
       Q =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQQ = CHSQALL;Q = CSQ;                                                
*********************************************************;                      
       CSS = S;LINK MODELFIT;LINK PUTPRED;                                      
       S =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQS = CHSQALL;S = CSS;                                                
*********************************************************;                      
       CSW = W;LINK MODELFIT;LINK PUTPRED;                                      
       W =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQW = CHSQALL;W = CSW;                                                
*********************************************************;                      
       CSV = V;LINK MODELFIT;LINK PUTPRED;                                      
       V =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQV = CHSQALL;V = CSV;                                                
*********************************************************;                      
       CSK = K;LINK MODELFIT;LINK PUTPRED;                                      
       K =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQK = CHSQALL;K = CSK;                                                
*********************************************************;                      
       CSJ = J;LINK MODELFIT;LINK PUTPRED;                                      
       J =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQJ = CHSQALL;J = CSJ;                                                
*********************************************************;                      
       CSY = Y;LINK MODELFIT;LINK PUTPRED;                                      
       Y =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQY = CHSQALL;Y = CSY;                                                
*********************************************************;                      
       CSD = D;LINK MODELFIT;LINK PUTPRED;                                      
       D =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQD = CHSQALL;D = CSD;                                                
*********************************************************;                      
       CSX = X;LINK MODELFIT;LINK PUTPRED;                                      
       X =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQX = CHSQALL;X = CSX;                                                
*********************************************************;                      
       CST = T;LINK MODELFIT;LINK PUTPRED;                                      
       T =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQT = CHSQALL;T = CST;                                                
*********************************************************;                      
       CSP = P;LINK MODELFIT;LINK PUTPRED;                                      
       P =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQP = CHSQALL;P = CSP;                                                
*********************************************************;                      
       CSE = E;LINK MODELFIT;LINK PUTPRED;                                      
       E =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQE = CHSQALL;E = CSE;                                                
*********************************************************;                      
       CSU = U;LINK MODELFIT;LINK PUTPRED;                                      
       U =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQU = CHSQALL;U = CSU;                                                
*********************************************************;                      
       CSZ = Z;LINK MODELFIT;LINK PUTPRED;                                      
       Z =  0 ;LINK MODELFIT;LINK CSFITS;                                       
       CHISQZ = CHSQALL;Z = CSZ;                                                
*********************************************************;                      
       CSLIM = LIM;LINK MODELFIT;LINK PUTPRED;                                  
       LIM =  0 ;LINK MODELFIT;LINK CSFITS;                                     
       CHISQLIM = CHSQALL;LIM = CSLIM;                                          
*********************************************************;                      
****  PREPARATION FOR OUTPUT ****************************;                      
*********************************************************;                      
       DP1 =  1 ;                                                               
       LINK MODELFIT;                                                           
       DP1 =  0 ;                                                               
       ALLFIT1 = ( RRSQUARE || DRSQUARE );                                      
       SYR1=F||(B||(M||(A||(G||(Q||S)))));                                      
       SYR2=W||(V||(K||(J||(Y||(D||X)))));                                      
       SYR3 = T || ( P || ( E || ( U || ( Z || LIM ) ) ) );                     
       SYSPAR = (SYR1||(SYR2||SYR3));                                           
       SCI1=CHISQF||(CHISQB||(CHISQM||(CHISQA||(CHISQG||(CHISQQ                 
       ||CHISQS)))));                                                           
       SCI2=CHISQW||(CHISQV||(CHISQK||(CHISQJ||(CHISQY||(                       
       CHISQD||CHISQX)))));                                                     
       SCI3 =CHISQT||(CHISQP||(CHISQE||(CHISQU||(CHISQZ||CHISQLIM))));          
       SYSCHI = (SCI1||(SCI2||SCI3));                                           
       ALLFITS = SHAPE( ALLFIT1 ,0 ,  1 );                                      
       SYSCHISQ = SHAPE( SYSCHI ,0 ,  1 );                                      
       SYSPARMS = SHAPE( SYSPAR ,0 ,  1 );                                      
       SYSEST = SYSPARMS || SYSCHISQ;                                           
       PRINT , C44 , SYSPARMS , SYSCHISQ , SYSEST , TESTLIST;                   
                                                                                
STUFF={PARMS CHISQ};                                                            
ROW = {'F' 'B' 'M' 'A' 'G' 'Q' 'S' 'W' 'V' 'K'                                  
       'J' 'Y' 'D' 'X' 'T' 'P' 'E' 'U' 'Z' 'LIM'};                              
CREATE BETAS FROM SYSEST (|COLNAME=STUFF ROWNAME=ROW|);                         
APPEND FROM SYSEST (|ROWNAME=ROW|);                                             
CLOSE BETAS;                                                                    
                                                                                
FIT={'FITS'};                                                                   
ROWW = {'RR' 'DD'};                                                             
CREATE FITS FROM ALLFITS (|COLNAME=FIT ROWNAME=ROWW|);                          
APPEND FROM ALLFITS (|ROWNAME=ROWW|);                                           
CLOSE FITS;                                                                     
                                                                                
TATA:                                                                           
                                                                                
VPARTY={VREPS VDEMS};                                                           
PPARTY={PREPS PDEMS};                                                           
BPARTY={RBASE DBASE};                                                           
ROW={'1950' '1952' '1954' '1956' '1958' '1960' '1962' '1964'                    
     '1966' '1968' '1970' '1972' '1974'                                         
     '1976' '1978' '1980' '1982' '1984'};                                       
                                                                                
CREATE REALVOTE FROM CREPDEM (|COLNAME=VPARTY ROWNAME=ROW|);                    
APPEND FROM CREPDEM (|ROWNAME=ROW|);                                            
CLOSE REALVOTE;                                                                 
                                                                                
CREATE PREDVOTE FROM PTRAJECT (|COLNAME=PPARTY ROWNAME=ROW|);                   
APPEND FROM PTRAJECT (|ROWNAME=ROW|);                                           
CLOSE PREDVOTE;                                                                 
                                                                                
CREATE PREDBASE FROM CONGBASE (|COLNAME=BPARTY ROWNAME=ROW|);                   
APPEND FROM CONGBASE (|ROWNAME=ROW|);                                           
CLOSE PREDBASE;                                                                 
                                                                                
END;                                                                            
FINISH;RUN;                                                                     
QUIT;                                                                           
                                                                                
PROC PRINT DATA=BETAS;VAR ROW PARMS CHISQ;                                      
PROC PRINT DATA=FITS;VAR ROWW FITS;