libname pmlr '.';

data pva(drop=control_number MONTHS_SINCE_LAST_PROM_RESP FILE_AVG_GIFT FILE_CARD_GIFT);
   set pmlr.pva_raw_data;
   STATUS_FL=RECENCY_STATUS_96NK in("F","L");
   STATUS_ES=RECENCY_STATUS_96NK in("E","S");
   home01=(HOME_OWNER="H");
   nses1=(SES="1");
   nses3=(SES="3");
   nses4=(SES="4");
   nses_=(SES="?");
   nurbr=(URBANICITY="R");
   nurbu=(URBANICITY="U");
   nurbs=(URBANICITY="S");
   nurbt=(URBANICITY="T");
   nurb_=(URBANICITY="?");
   ClusCdGrp1 = CLUSTER_CODE in("13", "20", "53", ".", "28");
   ClusCdGrp2 = CLUSTER_CODE in("16", "38", "03", "40", "18",
                                "24", "01", "14", "46", "35");
   ClusCdGrp3 = CLUSTER_CODE in("06", "10", "32", "41", "44", "47");
   ClusCdGrp4 = CLUSTER_CODE in("09", "43", "49", "51",
                                "21", "30", "45", "52",
                                "08", "37", "50");
   LIFETIME_GIFT_RANGE2=LIFETIME_GIFT_RANGE*LIFETIME_GIFT_RANGE;
run;

%let ex_inputs= MONTHS_SINCE_ORIGIN 
DONOR_AGE IN_HOUSE INCOME_GROUP PUBLISHED_PHONE
MOR_HIT_RATE WEALTH_RATING MEDIAN_HOME_VALUE
MEDIAN_HOUSEHOLD_INCOME PCT_OWNER_OCCUPIED
PER_CAPITA_INCOME PCT_MALE_MILITARY 
PCT_MALE_VETERANS PCT_VIETNAM_VETERANS 
PCT_WWII_VETERANS PEP_STAR RECENT_STAR_STATUS
FREQUENCY_STATUS_97NK RECENT_RESPONSE_PROP
RECENT_AVG_GIFT_AMT RECENT_CARD_RESPONSE_PROP
RECENT_AVG_CARD_GIFT_AMT RECENT_RESPONSE_COUNT
RECENT_CARD_RESPONSE_COUNT LIFETIME_CARD_PROM 
LIFETIME_PROM LIFETIME_GIFT_AMOUNT
LIFETIME_GIFT_COUNT LIFETIME_AVG_GIFT_AMT 
LIFETIME_GIFT_RANGE LIFETIME_MAX_GIFT_AMT
LIFETIME_MIN_GIFT_AMT LAST_GIFT_AMT
CARD_PROM_12 NUMBER_PROM_12 MONTHS_SINCE_LAST_GIFT
MONTHS_SINCE_FIRST_GIFT STATUS_FL STATUS_ES
home01 nses1 nses3 nses4 nses_ nurbr nurbu nurbs 
nurbt nurb_;

%let ex_reduced=
LIFETIME_CARD_PROM LIFETIME_MIN_GIFT_AMT  PER_CAPITA_INCOME
RECENT_RESPONSE_PROP  CARD_PROM_12  nses_ mi_DONOR_AGE  ClusCdGrp3
PCT_VIETNAM_VETERANS LIFETIME_GIFT_RANGE  nses3 PCT_MALE_VETERANS 
INCOME_GROUP STATUS_ES nurbu nurbt PCT_MALE_MILITARY DONOR_AGE
STATUS_FL MOR_HIT_RATE ClusCdGrp1 nurbr nurbs RECENT_STAR_STATUS 
PUBLISHED_PHONE MONTHS_SINCE_LAST_GIFT  IN_HOUSE WEALTH_RATING    
RECENT_AVG_GIFT_AMT home01 ClusCdGrp2 PCT_OWNER_OCCUPIED
;

%let ex_nvar=32;

%let ex_screened=
LIFETIME_CARD_PROM LIFETIME_MIN_GIFT_AMT  PER_CAPITA_INCOME
RECENT_RESPONSE_PROP  CARD_PROM_12  nses_ mi_DONOR_AGE  ClusCdGrp3
PCT_VIETNAM_VETERANS LIFETIME_GIFT_RANGE  nses3 PCT_MALE_VETERANS 
INCOME_GROUP STATUS_ES nurbu nurbt DONOR_AGE
STATUS_FL MOR_HIT_RATE ClusCdGrp1 nurbr nurbs RECENT_STAR_STATUS 
MONTHS_SINCE_LAST_GIFT  IN_HOUSE WEALTH_RATING    
RECENT_AVG_GIFT_AMT home01 ClusCdGrp2 PCT_OWNER_OCCUPIED
LIFETIME_GIFT_RANGE2
;

%let ex_pi1=0.05;

%let ex_selected =
LIFETIME_CARD_PROM RECENT_RESPONSE_PROP ClusCdGrp3 INCOME_GROUP STATUS_ES STATUS_FL
ClusCdGrp1 MONTHS_SINCE_LAST_GIFT RECENT_AVG_GIFT_AMT ClusCdGrp2
;



