SlideShare a Scribd company logo
 
/* forty categories in final table. check tiers & tiers2 tables
for inconsistencies*/
libname mast "/iim/corp1/core/all/mast/test_data";
libname attr '/iim/corp1/core/prod/canada';
libname canroc "/iim/corp1/core/roc/canada";
libname usroc "/iim/corp1/core/roc/us";
proc contents data=attr.acct_attr;
run;
proc contents data=mast.mast_cm_canada;
run;
proc contents data=mast.mast_cid_canada;
run;
/*product*/
proc contents data=mast.mast_cm_canada;
run;
proc freq data= mast.mast_cm_canada;
tables Market_Product;
run;
%let period1 = 01NOV2014;
%let period2 = 01DEC2014;
/*first*/
data aeroplan_&period1.(keep=cg_id year month cv_mon rocs cif
market_product);
set mast.mast_cm_canada;
year=year(month);
where (month)="&period1"d;
run;
data aeroplan2_&period1.;
set aeroplan_&period1.;
length product $32.;
if (market_product) in ('Aeroplan/Gold','Aeroplan/Platinum',
'Aeroplan/Elite Gold') then
product = 'Cobrand';
else if (market_product) not in ('Aeroplan/Gold','Aeroplan/
Platinum', 'Aeroplan/Elite Gold')then
product = 'Other';
run;
proc freq data= aeroplan2_&period1.;
tables market_product;
run;
proc summary data=aeroplan2_&period1. nway noprint missing;
class cg_id month product;
output out=aeroplan2_&period1._summ (drop=_type_ _freq_)
sum(cif)= sum(rocs)= sum(cv_mon)=;
run;
/*second*/
data aeroplan_&period2.(keep=cg_id year month rocs cif cv_mon
market_product);
set mast.mast_cm_canada;
year=year(month);
where (month)="&period2"d;
run;
data aeroplan2_&period2.;
set aeroplan_&period2.;
length product $32.;
if (market_product) in ('Aeroplan/Gold','Aeroplan/Platinum',
'Aeroplan/Elite Gold') then
product = 'Cobrand';
else if (market_product) not in ('Aeroplan/Gold','Aeroplan/
Platinum', 'Aeroplan/Elite Gold')then
product = 'Other';
run;
proc summary data=aeroplan2_&period2. nway noprint missing;
class cg_id month product ;
output out=aeroplan2_&period2._summ (drop=_type_ _freq_)
sum(cif)= sum(rocs)= sum(cv_mon)=;
run;
proc sort data=aeroplan2_&period1._summ;
by cg_id product;
run;
proc sort data=aeroplan2_&period2._summ;
by cg_id product;
run;
/*transpose metrics*/
proc transpose data=aeroplan2_&period1._summ
out=aeroplan_&period1._cifs(drop=_:) prefix=prevcifs_;
by cg_id;
id product;
var cif ;
run;
proc transpose data=aeroplan2_&period2._summ
out=aeroplan_&period2._cifs(drop=_:) prefix=currcifs_;
by cg_id;
id product;
var cif ;
run;
proc transpose data=aeroplan2_&period1._summ
out=aeroplan_&period1._rocs(drop=_:) prefix=prevrocs_;
by cg_id;
id product;
var rocs ;
run;
proc transpose data=aeroplan2_&period2._summ
out=aeroplan_&period2._rocs(drop=_:) prefix=currrocs_;
by cg_id;
id product;
var rocs;
run;
proc transpose data=aeroplan2_&period1._summ
out=aeroplan_&period1._cv(drop=_:) prefix=prevcv_;
by cg_id;
id product;
var cv_mon;
run;
proc transpose data=aeroplan2_&period2._summ
out=aeroplan_&period2._cv(drop=_:) prefix=currcv_;
by cg_id;
id product;
var cv_mon;
run;
data merged;
merge aeroplan_&period1._cifs
aeroplan_&period2._cifs
aeroplan_&period1._cv
aeroplan_&period2._cv
aeroplan_&period1._rocs
aeroplan_&period2._rocs;
by cg_id;
run;
data merged2;
length type $32.;
set merged;
if (prevcifs_cobrand)> 0 and (currcifs_cobrand) >0 then type =
'organic'; else
if missing (prevcifs_cobrand) and missing (prevcifs_other) and
(currcifs_cobrand)>0 then type = 'new_new'; else
if (prevcifs_other) >0 and missing(prevcifs_cobrand) and
(currcifs_cobrand)>0 then type = 'new_expansion'; else
if missing(currcifs_cobrand) and (prevcifs_cobrand)>0 then type
= 'loss';
run;
/*portrfolio sheet*/
proc summary data=merged2 nway noprint missing;
class type;
output out = acct_summ (drop=_type_ rename=(_freq_ =
accounts))sum(currcifs_cobrand)= sum(currrocs_cobrand)=
sum(currcv_cobrand)=;
where type ne '';
run;
proc freq data= merged2;
tables type;
run;
libname mcidlib "/iim/corp1/core/all/master_cid";
/*tiers*/
proc contents data = attr.acct_attr;
run;
data tiers(keep=cg_id market market_product acct11 cd_no
mr_tier_cd mr_tier_class);
set attr.acct_attr;
where (market = 'canada' and market_product like ('Aero%'));
run;
/* Platinum cards that are tier W earners*/
data tiers;
set tiers;
if acct11 in ('37906354189', '37906354489',
'37906354789',
'37906355589', '37906355689',
'37906355789',
'37906355889',
'37906355989','37906244837',
'37906340579', '37906381766')
then
mr_tier_cd = 'W';
run;
/******************/
data tiers2;
set tiers;
if mr_tier_cd = 'W' then class=1; else
if mr_tier_cd = 'X' then class=.5;
run;
proc sort data=tiers2;
by acct11 cd_no;
run;
proc transpose data=tiers2 out=tiers2_summ(drop=_:)
prefix=tier_; /*some tier codes missing*/
by acct11 cd_no;
id mr_tier_cd;
var class;
run;
proc freq data= tiers;
tables cd_no;
run;
data acct_tiers(keep=cd_no tier_W tier_X acct11);
merge tiers2_summ
tiers2;
by acct11 cd_no;
run;
data acct_tiers;
set acct_tiers;
if tier_x = '' and tier_w='' then delete;
run;
data tiers_&period2.(keep=acct11 year month cd_no cv_mon rocs
cif market_product);
set mast.mast_cm_canada;
year=year(month);
where (month)="&period2"d and market_product in ('Aeroplan/
Gold','Aeroplan/Platinum', 'Aeroplan/Elite Gold');
run;
proc summary data=tiers_&period2. nway noprint missing;
class acct11 cd_no month market_product cif ;
output out=tiers2_&period2._summ (drop=_type_ _freq_) sum(rocs)=
sum(cv_mon)=;
run;
proc sort data=acct_tiers;
by acct11 cd_no;
run;
proc sort data=tiers2_&period2._summ;
by acct11 cd_no;
run;
data tiers_&period2._cv(keep=tier_: cd_no acct11 market_product
rocs cif cv_mon);
merge tiers2_&period2._summ (in=a)
acct_tiers (in=b);
by acct11 cd_no;
if a and b;
run;
/*inactive & active cif*/
proc summary data=tiers_&period2._cv nway noprint missing;
class market_product tier_: cif;
output out=product_&period2 (drop=_type_ rename=(_freq_ =
cifs))sum(cv_mon)= sum(rocs)= ;
run;
/* find merchants*/
/* air canada*/
/*proc sql ;
connect to sybase (user=user pass=pass server=IQAX) ;
create table aircan as select * from connection to sybase
( select dba_nm, se10 from dbo.se_char )
where upcase(dba_nm) like ('AIR CANADA%');
quit;*/
%include '~/.sasnetrc' ;
proc sql;
connect to teradata (user=&tduser server=edw pass=&tdpass
database=udw mode=teradata connection=global);
create table aircan as
select * from connection to teradata
(select dba_nm, se10
from udw.se_char
where dba_nm (NOT CASESPECIFIC) like ('AIR CANADA%')
);
disconnect from teradata;
quit;
data aircan2;
length senumber $10.;
set aircan;
where upcase(dba_nm) in
('AIR CANADA',
'AIR CANADA (EUROPE)',
'AIR CANADA (GLOBAL)',
'AIR CANADA IRELAND',
'AIR CANADA (LAC)',
'AIR CANADA (JAPA)',
'AIR CANADA (EMEA)',
'AIR CANADA (NORTH AMERICA)',
'AIR CANADA GUADALAJARA',
'AIR CANADA DENMARK',
'AIR CANADA FRANCE',
'AIR CANADA GERMANY',
'AIR CANADA ITALY',
'AIR CANADA NETHERLANDS'
'AIR CANADA NORWAY',
'AIR CANADA SPAIN',
'AIR CANADA SWEDEN',
'AIR CANADA SWITZERLAND',
'AIR CANADA CHINA',
'AIR CANADA EGYPT',
'AIR CANADA TAIWAN',
'AIR CANADA COSTA RICA',
'AIR CANADA CZECH',
'AIR CANADA HUNGARY',
'AIR CANADA MALAYSIA',
'AIR CANADA POLAND',
'AIR CANADA SAUDI',
'AIR CANADA SINGAPORE',
'AIR CANADA THAILAND',
'AIR CANADA SAUDI ARABIA',
'AIR CANADA BAHRAIN',
'AIR CANADA OMANI',
'AIR CANADA QATAR',
'AIR CANADA KUWAIT',
'AIR CANADA JORDAN',
'AIR CANADA AUSTRALIA',
'AIR CANADA JAPAN',
'AIR CANADA HONG KONG',
'AIR CANADA U.K.',
'AIR CANADA UAE',
'AIR CANADA, CANADA',
'AIR CANADA TURKEY',
'AIR CANADA - AUSTRALIA'
'AIR CANADA OSAKA',
'AIR CANADA SHANGHAI OFFICE',
'AIR CANADA SUC.ARGENTINA');
senumber=se10;
run;
/*Marriott*/
/*proc sql;
connect to sybase (user=user pass=pass server=IQAX) ;
create table marriott as select * from connection to sybase
( select dba_nm, se10, city, state_cd, country_cd
from dbo.se_char )
where upcase(dba_nm) like ('%MARRIOTT HOTELS%')
or
upcase(dba_nm) like ('%JW MARRIOTT%') or
upcase(dba_nm) like ('%RENAISSANCE HOTELS%') or
upcase(dba_nm) like ('%COURTYARD BY MARRIOTT%') or
upcase(dba_nm) like ('%RESIDENCE INN%') or
upcase(dba_nm) like ('%SPRINGHILL SUITES%') or
upcase(dba_nm) like ('%FAIRFIELD INN%') or
upcase(dba_nm) like ('%TOWNEPLACE SUITES%');
quit;*/
proc sql;
connect to teradata (user=&tduser server=edw pass=&tdpass
database=udw mode=teradata connection=global);
create table marriott as select * from connection to teradata
( select dba_nm, se10, city, state_cd, country_cd
from udw.se_char
where dba_nm (NOT CASESPECIFIC) like ('%MARRIOTT
HOTELS%') or
dba_nm (NOT CASESPECIFIC) like ('%JW
MARRIOTT%') orf
dba_nm (NOT CASESPECIFIC) like
('%RENAISSANCE HOTELS%') or
dba_nm (NOT CASESPECIFIC) like ('%COURTYARD
BY MARRIOTT%') or
dba_nm (NOT CASESPECIFIC) like ('%RESIDENCE
INN%') or
dba_nm (NOT CASESPECIFIC) like
('%SPRINGHILL SUITES%') or
dba_nm (NOT CASESPECIFIC) like ('%FAIRFIELD
INN%') or
dba_nm (NOT CASESPECIFIC) like
('%TOWNEPLACE SUITES%')
);
disconnect from teradata;
quit;
proc sort data=marriott;
by dba_nm;
run;
data marriott2;
length senumber $10.;
set marriott;
where /*country_cd = '124' and*/ (city) not in ('NIAGARA FALLS',
'MONT TREMBLANT');
/*Marriott Canada only locations.
Niagara Falls, ON, Mont Tremblant, Quebec are not part of the
program*/
senumber=se10;
run;
/*Avis Budget Group*/
/*proc sql;
connect to sybase (user=user pass=pass server=IQAX) ;
create table abg as select * from connection to sybase
( select dba_nm, se10, city, state_cd, country_cd
from dbo.se_char )
where upcase(dba_nm) like ('%AVIS RENT%')
or upcase(dba_nm) like('%BUDGET RENT%')
or upcase(dba_nm) like('%AVIS BUDGET%');
quit; */
proc sql;
connect to teradata (user=&tduser server=edw pass=&tdpass
database=udw mode=teradata connection=global);
create table abg as select * from connection to teradata
( select dba_nm, se10, city, state_cd, country_cd
from udw.se_char
where dba_nm (NOT CASESPECIFIC) like ('%AVIS
RENT%') or
dba_nm (NOT CASESPECIFIC) like ('%BUDGET
RENT%') or
dba_nm (NOT CASESPECIFIC) like ('%AVIS
BUDGET%')
);
disconnect from teradata;
quit;
data abg2;
length senumber $10.;
set abg;
where country_cd in('840', '124'); /*US and Canadian Avis/Budget
locations*/
senumber=se10;
run;
/*cobrand cids*/
proc summary data=aeroplan2_&period2. nway noprint missing;
class cg_id product;
output out=cobrand_cids_&period2. (drop=_type_ _freq_);
where product = 'Cobrand';
run;
/*canada & us cv*/
data canroc_&period2.;
set canroc.trans_201412; /*define period2*/
where senumber not in ('0000000000','0000000001', '0000000002',
'0000000003', '');
run;
data usroc_&period2.;
set usroc.trans_201412; /*define period2*/
where senumber not in ('0000000000','0000000001', '0000000002',
'0000000003', '');
run;
proc sort data=canroc_&period2.;
by senumber;
run;
proc sort data=usroc_&period2.;
by senumber;
run;
data roc_&period2;
set usroc_&period2 canroc_&period2.;
run;
proc sort data=roc_&period2.;
by senumber;
run;
/*aircanada*/
proc sort data=aircan2;
by senumber;
run;
data ac_roc_&period2.(keep=cg_id procmon cv dba_nm);
merge roc_&period2. (in=a)
aircan2(in=b);
by senumber;
if a and b;
run;
proc summary data=ac_roc_&period2. nway noprint missing;
class procmon cg_id;
output out=ac_roc_summ_&period2. (drop=_type_
rename=(_freq_=rocs)) sum(cv)=;
run;
proc sort data=ac_roc_summ_&period2.;
by cg_id;
run;
proc sort data=cobrand_cids_&period2.;
by cg_id;
run;
data ac_cobrand_&period2.;
merge ac_roc_summ_&period2. (in=a)
cobrand_cids_&period2. (in=b);
by cg_id;
if a and b;
run;
proc summary data=ac_cobrand_&period2. nway noprint missing;
class procmon;
output out=ac_cobrand_&period2._summ (drop=_type_
_freq_)sum(rocs)=sum(cv)=;
run;
data ac_cobrand_&period2._summ;
length partner $64.;
partner="Air Canada";
set ac_cobrand_&period2._summ;
run;
/* avis budget group us & canada cv*/
proc sort data=roc_&period2.;
by senumber;
run;
proc sort data=abg2;
by senumber;
run;
data abg_roc_&period2.;
merge roc_&period2. (in=a)
abg2(in=b);
by senumber;
if a and b;
run;
proc summary data=abg_roc_&period2. nway noprint missing;
class procmon cg_id;
output out=abg_roc_&period2._summ (drop=_type_
rename=(_freq_=rocs)) sum(cv)=;
run;
proc sort data=abg_roc_&period2._summ;
by cg_id;
run;
proc sort data=cobrand_cids_&period2;
by cg_id;
run;
data abg_cobrand_&period2.;
merge abg_roc_&period2._summ (in=a)
cobrand_cids_&period2. (in=b);
by cg_id;
if a and b;
run;
proc summary data=abg_cobrand_&period2. nway noprint missing;
class procmon;
output out=abg_cobrand_&period2._summ (drop=_type_
_freq_)sum(rocs)= sum(cv)= ;
run;
data abg_cobrand_&period2._summ;
length partner $64.;
partner="Avis Budget Group";
set abg_cobrand_&period2._summ;
run;
/* marriott*/
proc sort data=marriott2;
by senumber;
run;
data mar_roc_&period2.;
merge canroc_&period2. (in=a)
marriott2(in=b);
by senumber;
if a and b;
run;
proc summary data=mar_roc_&period2. nway noprint missing;
class procmon cg_id;
output out=mar_roc_&period2._summ (drop=_type_ rename=(_freq_ =
rocs)) sum(cv)=;
run;
proc sort data=canroc_&period2.;
by cg_id;
run;
proc sort data=mar_roc_&period2._summ;
by cg_id;
run;
proc sort data=cobrand_cids_&period2.;
by cg_id;
run;
data mar_cobrand_&period2.;
merge mar_roc_&period2._summ (in=a)
cobrand_cids_&period2. (in=b);
by cg_id;
if a and b;
run;
proc summary data=mar_cobrand_&period2. nway noprint missing;
class procmon;
output out=mar_cobrand_&period2._summ (drop=_type_
_freq_)sum(rocs)=sum(cv)=;
run;
data mar_cobrand_&period2._summ;
length partner $64.;
partner="Marriott";
set mar_cobrand_&period2._summ;
run;
/* combine partners*/
libname aerolib "/iim/corp3/2014032_kmille_aeroplan";
data partners_cv (drop=rocs metric partner);
length metric label $64.;
set ac_cobrand_&period2._summ
abg_cobrand_&period2._summ
mar_cobrand_&period2._summ;
metric='cv';
label=strip(partner)||"_"||strip(metric);
run;
data partners_rocs (drop=cv metric partner);
length metric label $64.;
set ac_cobrand_&period2._summ
abg_cobrand_&period2._summ
mar_cobrand_&period2._summ;
metric='rocs';
label=strip(partner)||"_"||strip(metric);
run;
proc transpose data=partners_cv out=partners_cv(drop=_:) ;
by label;
id procmon;
var cv;
run;
proc transpose data=partners_rocs out=partners_rocs(drop=_:) ;
by label;
id procmon;
var rocs;
run;
data combined_&period2.;
set partners_rocs partners_cv;
run;
/*combine acct status*/
data cv_summ(drop=currrocs_cobrand currcifs_cobrand accounts
type metric);
length metric label $64.;
format month mmddyy10.;
set acct_summ;
metric = 'cv';
label=strip(type)||"_"||strip(metric);
month = "&period2"d;
run;
data rocs_summ(drop=currcv_cobrand currcifs_cobrand accounts
type metric);
length metric label$64.;
format month mmddyy10.;
set acct_summ;
metric='rocs';
label=strip(type)||"_"||strip(metric);
month = "&period2"d;
run;
data cifs_summ(drop=currcv_cobrand currrocs_cobrand accounts
type metric);
length metric $64.;
format month mmddyy10.;
set acct_summ;
metric='cifs';
label=strip(type)||"_"||strip(metric);
month = "&period2"d;
run;
data accounts_summ(drop=currcv_cobrand currrocs_cobrand
currcifs_cobrand type metric);
length metric $64.;
format month mmddyy10.;
set acct_summ;
metric='accounts';
label=strip(type)||"_"||strip(metric);
month = "&period2"d;
run;
proc transpose data=cv_summ out=cv_summ(drop=_:) ;
by label;
id month;
var currcv_cobrand;
run;
proc transpose data=rocs_summ out=rocs_summ(drop=_:) ;
by label;
id month;
var currrocs_cobrand;
run;
proc transpose data=cifs_summ out=cifs_summ(drop=_:) ;
by label;
id month;
var currcifs_cobrand;
run;
proc transpose data=accounts_summ out=accounts_summ(drop=_:) ;
by label;
id month;
var accounts;
run;
data combined2_&period2.;
set cv_summ rocs_summ cifs_summ accounts_summ combined_&period2;
run;
/*combine product*/
data product_cv_summ(drop=cifs rocs metric market_product tier_w
tier_x cif);
length metric label $64.;
format month mmddyy10.;
set product_&period2.;
metric = 'cv';
label=strip(market_product)||"_"||strip(metric)||"_"||
strip(tier_w)||"_"||strip(tier_x)||"_"||strip(cif);
month = "&period2"d;
run;
data product_cifs_summ(drop=cv_mon rocs metric market_product
tier_w tier_x cif);
length metric $64.;
format month mmddyy10.;
set product_&period2.;
metric = 'cifs';
label=strip(market_product)||"_"||strip(metric)||"_"||
strip(tier_w)||"_"||strip(tier_x)||"_"||strip(cif);
month = "&period2"d;
run;
data product_rocs_summ(drop=cv_mon cifs metric market_product
tier_w tier_x cif);
length metric $64.;
format month mmddyy10.;
set product_&period2.;
metric = 'rocs';
label=strip(market_product)||"_"||strip(metric)||"_"||
strip(tier_w)||"_"||strip(tier_x)||"_"||strip(cif);
month = "&period2"d;
run;
proc transpose data=product_cv_summ
out=product_cv_summ2(drop=_:) ;
by label;
id month;
var cv_mon;
run;
proc transpose data=product_cifs_summ
out=product_cifs_summ2(drop=_:) ;
by label;
id month;
var cifs;
run;
proc transpose data=product_rocs_summ
out=product_rocs_summ2(drop=_:) ;
by label;
id month;
var rocs;
run;
data aerolib.combined3_&period2.;
set product_cv_summ2 product_rocs_summ2 product_cifs_summ2
combined2_&period2;
run;
/*monthly*/
proc sort data=aerolib.combined3_01jan2014;
by label;
run;
proc sort data=aerolib.combined3_01feb2014;
by label;
run;
proc sort data=aerolib.combined3_01mar2014;
by label;
run;
proc sort data=aerolib.combined3_01apr2014;
by label;
run;
proc sort data=aerolib.combined3_01may2014;
by label;
run;
proc sort data=aerolib.combined3_01jun2014;
by label;
run;
proc sort data=aerolib.combined3_01jul2014;
by label;
run;
proc sort data=aerolib.combined3_01aug2014;
by label;
run;
proc sort data=aerolib.combined3_01sep2014;
by label;
run;
proc sort data=aerolib.combined3_01oct2014;
by label;
run;
proc sort data=aerolib.combined3_01nov2014;
by label;
run;
proc sort data=aerolib.combined3_01dec2014;
by label;
run;
data aerolib.final;
merge aerolib.combined3_01JAN2014
aerolib.combined3_01FEB2014 aerolib.combined3_01MAR2014
aerolib.combined3_01APR2014
aerolib.combined3_01MAY2014 aerolib.combined3_01JUN2014
aerolib.combined3_01JUL2014
aerolib.combined3_01AUG2014 aerolib.combined3_01SEP2014
aerolib.combined3_01OCT2014
aerolib.combined3_01NOV2014 aerolib.combined3_01DEC2014;
by label;
run;
 
Kenneth Miller
-------------------------------------
Corporate Insight and Analytics | RIM
Global Corporate Payments
AEDR - Phoenix
Email: kenneth.miller1@aexp.com | Office: 602.537.9687
 
American Express made the following annotations
"This message and any attachments are solely for the intended recipient and may
contain confidential or privileged information. If you are not the intended recipient, any
disclosure, copying, use, or distribution of the information included in this message and
any attachments is prohibited. If you have received this communication in error, please
notify us by reply e-mail and immediately and permanently delete this message and any
attachments. Thank you."
American Express a ajouté le commentaire suivant le
Ce courrier et toute pièce jointe qu'il contient sont réservés au seul destinataire indiqué
et peuvent renfermer des renseignements confidentiels et privilégiés. Si vous n'êtes pas
le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courrier
ou de toute pièce jointe est interdite. Si vous avez reçu cette communication par erreur,
veuillez nous en aviser par courrier et détruire immédiatement le courrier et les pièces
jointes. Merci.

More Related Content

What's hot

Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
Aleix Vergés
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
Ross Tuck
 
ATK 'Beyond The Pizza Guides'
ATK 'Beyond The Pizza Guides'ATK 'Beyond The Pizza Guides'
ATK 'Beyond The Pizza Guides'
Ibuildings
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
Hugo Hamon
 
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
Hugo Hamon
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
Hugo Hamon
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
Hugo Hamon
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
Masahiro Honma
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
Michelangelo van Dam
 
When cqrs meets event sourcing
When cqrs meets event sourcingWhen cqrs meets event sourcing
When cqrs meets event sourcing
Manel Sellés
 
Func dyn title_set.c
Func dyn title_set.cFunc dyn title_set.c
Func dyn title_set.calbertinous
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
Marcus Ramberg
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
Sam Hennessy
 
R57shell
R57shellR57shell
R57shell
ady36
 
Gta v savegame
Gta v savegameGta v savegame
Gta v savegame
hozayfa999
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
Nate Abele
 

What's hot (19)

Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
 
C99
C99C99
C99
 
ATK 'Beyond The Pizza Guides'
ATK 'Beyond The Pizza Guides'ATK 'Beyond The Pizza Guides'
ATK 'Beyond The Pizza Guides'
 
Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
 
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
 
When cqrs meets event sourcing
When cqrs meets event sourcingWhen cqrs meets event sourcing
When cqrs meets event sourcing
 
Func dyn title_set.c
Func dyn title_set.cFunc dyn title_set.c
Func dyn title_set.c
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
 
R57shell
R57shellR57shell
R57shell
 
Gta v savegame
Gta v savegameGta v savegame
Gta v savegame
 
zinno
zinnozinno
zinno
 
201104 iphone navigation-based apps
201104 iphone navigation-based apps201104 iphone navigation-based apps
201104 iphone navigation-based apps
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 

Viewers also liked

Amjad awwad resume
Amjad awwad   resumeAmjad awwad   resume
Amjad awwad resume
Amjad Awwad, CSP CMIOSH
 
838_resume1384267284.docx-2.doc copy 2
838_resume1384267284.docx-2.doc copy 2838_resume1384267284.docx-2.doc copy 2
838_resume1384267284.docx-2.doc copy 2WILLIE CHREE
 
LBF Resume
LBF ResumeLBF Resume
LBF Resume
Leandro Bricio
 
Cv Sulaiman Alnaimat cv (oct 2016) doc
Cv Sulaiman Alnaimat cv (oct 2016) docCv Sulaiman Alnaimat cv (oct 2016) doc
Cv Sulaiman Alnaimat cv (oct 2016) doc
Sulaiman Alnaimat
 
Resume / Cv - Goncalo Silva
Resume / Cv  - Goncalo SilvaResume / Cv  - Goncalo Silva
Resume / Cv - Goncalo Silva
Goncalo Silva
 
Sue Larrarte - Resume updated
Sue Larrarte - Resume updatedSue Larrarte - Resume updated
Sue Larrarte - Resume updatedSue Larrarte
 
R deveau resume
R deveau resumeR deveau resume
R deveau resume
Roger DeVeau
 
Kevin wandera
Kevin wanderaKevin wandera
Kevin wandera
kevin wandera
 
Jordan Wallins Resume Sep 16
Jordan Wallins Resume Sep 16Jordan Wallins Resume Sep 16
Jordan Wallins Resume Sep 16Jordan Wallins
 

Viewers also liked (17)

Amjad awwad resume
Amjad awwad   resumeAmjad awwad   resume
Amjad awwad resume
 
Resume
ResumeResume
Resume
 
RobertResume2016
RobertResume2016RobertResume2016
RobertResume2016
 
Tracey Luftspring-Resume
Tracey Luftspring-ResumeTracey Luftspring-Resume
Tracey Luftspring-Resume
 
838_resume1384267284.docx-2.doc copy 2
838_resume1384267284.docx-2.doc copy 2838_resume1384267284.docx-2.doc copy 2
838_resume1384267284.docx-2.doc copy 2
 
Resume_roberto[2]
Resume_roberto[2]Resume_roberto[2]
Resume_roberto[2]
 
LBF Resume
LBF ResumeLBF Resume
LBF Resume
 
CV Hamahoullah_English
CV Hamahoullah_EnglishCV Hamahoullah_English
CV Hamahoullah_English
 
Cv Sulaiman Alnaimat cv (oct 2016) doc
Cv Sulaiman Alnaimat cv (oct 2016) docCv Sulaiman Alnaimat cv (oct 2016) doc
Cv Sulaiman Alnaimat cv (oct 2016) doc
 
Resume / Cv - Goncalo Silva
Resume / Cv  - Goncalo SilvaResume / Cv  - Goncalo Silva
Resume / Cv - Goncalo Silva
 
nancy resume july 2016
nancy resume july 2016nancy resume july 2016
nancy resume july 2016
 
Tony_Smith_CV-Sept 2016
Tony_Smith_CV-Sept 2016Tony_Smith_CV-Sept 2016
Tony_Smith_CV-Sept 2016
 
Alyssa resume 2016 pdf
Alyssa resume 2016 pdfAlyssa resume 2016 pdf
Alyssa resume 2016 pdf
 
Sue Larrarte - Resume updated
Sue Larrarte - Resume updatedSue Larrarte - Resume updated
Sue Larrarte - Resume updated
 
R deveau resume
R deveau resumeR deveau resume
R deveau resume
 
Kevin wandera
Kevin wanderaKevin wandera
Kevin wandera
 
Jordan Wallins Resume Sep 16
Jordan Wallins Resume Sep 16Jordan Wallins Resume Sep 16
Jordan Wallins Resume Sep 16
 

Similar to sas aeroplan sample

Gps c
Gps cGps c
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019
Ayesh Karunaratne
 
Adding Statistical Functionality to the DATA Step with PROC FCMP
Adding Statistical Functionality to the DATA Step with PROC FCMPAdding Statistical Functionality to the DATA Step with PROC FCMP
Adding Statistical Functionality to the DATA Step with PROC FCMP
Jacques Rioux
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
ady36
 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 Usage
William Lee
 
SAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codesSAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codes
rizrazariz
 
This is not your father's monitoring.
This is not your father's monitoring.This is not your father's monitoring.
This is not your father's monitoring.
Mathias Herberts
 
Memory Manglement in Raku
Memory Manglement in RakuMemory Manglement in Raku
Memory Manglement in Raku
Workhorse Computing
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
Jim Mlodgenski
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2
ady36
 
Sydney Oracle Meetup - execution plans
Sydney Oracle Meetup - execution plansSydney Oracle Meetup - execution plans
Sydney Oracle Meetup - execution planspaulguerin
 
SAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codessSAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codess
rizrazariz
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
noc_313
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
APNIC
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
Visual Engineering
 
망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15종인 전
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
PgDay.Seoul
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 

Similar to sas aeroplan sample (20)

Gps c
Gps cGps c
Gps c
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019
 
R57.Php
R57.PhpR57.Php
R57.Php
 
Adding Statistical Functionality to the DATA Step with PROC FCMP
Adding Statistical Functionality to the DATA Step with PROC FCMPAdding Statistical Functionality to the DATA Step with PROC FCMP
Adding Statistical Functionality to the DATA Step with PROC FCMP
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 Usage
 
SAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codesSAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codes
 
This is not your father's monitoring.
This is not your father's monitoring.This is not your father's monitoring.
This is not your father's monitoring.
 
Memory Manglement in Raku
Memory Manglement in RakuMemory Manglement in Raku
Memory Manglement in Raku
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2
 
Sydney Oracle Meetup - execution plans
Sydney Oracle Meetup - execution plansSydney Oracle Meetup - execution plans
Sydney Oracle Meetup - execution plans
 
SAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codessSAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codess
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
 
망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 

sas aeroplan sample

  • 1.   /* forty categories in final table. check tiers & tiers2 tables for inconsistencies*/ libname mast "/iim/corp1/core/all/mast/test_data"; libname attr '/iim/corp1/core/prod/canada'; libname canroc "/iim/corp1/core/roc/canada"; libname usroc "/iim/corp1/core/roc/us"; proc contents data=attr.acct_attr; run; proc contents data=mast.mast_cm_canada; run; proc contents data=mast.mast_cid_canada; run; /*product*/ proc contents data=mast.mast_cm_canada; run; proc freq data= mast.mast_cm_canada; tables Market_Product; run; %let period1 = 01NOV2014; %let period2 = 01DEC2014; /*first*/ data aeroplan_&period1.(keep=cg_id year month cv_mon rocs cif market_product); set mast.mast_cm_canada; year=year(month); where (month)="&period1"d; run; data aeroplan2_&period1.; set aeroplan_&period1.; length product $32.; if (market_product) in ('Aeroplan/Gold','Aeroplan/Platinum', 'Aeroplan/Elite Gold') then
  • 2. product = 'Cobrand'; else if (market_product) not in ('Aeroplan/Gold','Aeroplan/ Platinum', 'Aeroplan/Elite Gold')then product = 'Other'; run; proc freq data= aeroplan2_&period1.; tables market_product; run; proc summary data=aeroplan2_&period1. nway noprint missing; class cg_id month product; output out=aeroplan2_&period1._summ (drop=_type_ _freq_) sum(cif)= sum(rocs)= sum(cv_mon)=; run; /*second*/ data aeroplan_&period2.(keep=cg_id year month rocs cif cv_mon market_product); set mast.mast_cm_canada; year=year(month); where (month)="&period2"d; run; data aeroplan2_&period2.; set aeroplan_&period2.; length product $32.; if (market_product) in ('Aeroplan/Gold','Aeroplan/Platinum', 'Aeroplan/Elite Gold') then product = 'Cobrand'; else if (market_product) not in ('Aeroplan/Gold','Aeroplan/ Platinum', 'Aeroplan/Elite Gold')then product = 'Other'; run; proc summary data=aeroplan2_&period2. nway noprint missing; class cg_id month product ; output out=aeroplan2_&period2._summ (drop=_type_ _freq_) sum(cif)= sum(rocs)= sum(cv_mon)=; run; proc sort data=aeroplan2_&period1._summ; by cg_id product; run;
  • 3. proc sort data=aeroplan2_&period2._summ; by cg_id product; run; /*transpose metrics*/ proc transpose data=aeroplan2_&period1._summ out=aeroplan_&period1._cifs(drop=_:) prefix=prevcifs_; by cg_id; id product; var cif ; run; proc transpose data=aeroplan2_&period2._summ out=aeroplan_&period2._cifs(drop=_:) prefix=currcifs_; by cg_id; id product; var cif ; run; proc transpose data=aeroplan2_&period1._summ out=aeroplan_&period1._rocs(drop=_:) prefix=prevrocs_; by cg_id; id product; var rocs ; run; proc transpose data=aeroplan2_&period2._summ out=aeroplan_&period2._rocs(drop=_:) prefix=currrocs_; by cg_id; id product; var rocs; run; proc transpose data=aeroplan2_&period1._summ out=aeroplan_&period1._cv(drop=_:) prefix=prevcv_; by cg_id; id product; var cv_mon; run; proc transpose data=aeroplan2_&period2._summ out=aeroplan_&period2._cv(drop=_:) prefix=currcv_; by cg_id; id product; var cv_mon;
  • 4. run; data merged; merge aeroplan_&period1._cifs aeroplan_&period2._cifs aeroplan_&period1._cv aeroplan_&period2._cv aeroplan_&period1._rocs aeroplan_&period2._rocs; by cg_id; run; data merged2; length type $32.; set merged; if (prevcifs_cobrand)> 0 and (currcifs_cobrand) >0 then type = 'organic'; else if missing (prevcifs_cobrand) and missing (prevcifs_other) and (currcifs_cobrand)>0 then type = 'new_new'; else if (prevcifs_other) >0 and missing(prevcifs_cobrand) and (currcifs_cobrand)>0 then type = 'new_expansion'; else if missing(currcifs_cobrand) and (prevcifs_cobrand)>0 then type = 'loss'; run; /*portrfolio sheet*/ proc summary data=merged2 nway noprint missing; class type; output out = acct_summ (drop=_type_ rename=(_freq_ = accounts))sum(currcifs_cobrand)= sum(currrocs_cobrand)= sum(currcv_cobrand)=; where type ne ''; run; proc freq data= merged2; tables type; run; libname mcidlib "/iim/corp1/core/all/master_cid"; /*tiers*/ proc contents data = attr.acct_attr; run;
  • 5. data tiers(keep=cg_id market market_product acct11 cd_no mr_tier_cd mr_tier_class); set attr.acct_attr; where (market = 'canada' and market_product like ('Aero%')); run; /* Platinum cards that are tier W earners*/ data tiers; set tiers; if acct11 in ('37906354189', '37906354489', '37906354789', '37906355589', '37906355689', '37906355789', '37906355889', '37906355989','37906244837', '37906340579', '37906381766') then mr_tier_cd = 'W'; run; /******************/ data tiers2; set tiers; if mr_tier_cd = 'W' then class=1; else if mr_tier_cd = 'X' then class=.5; run; proc sort data=tiers2; by acct11 cd_no; run; proc transpose data=tiers2 out=tiers2_summ(drop=_:) prefix=tier_; /*some tier codes missing*/ by acct11 cd_no; id mr_tier_cd; var class; run; proc freq data= tiers; tables cd_no; run; data acct_tiers(keep=cd_no tier_W tier_X acct11);
  • 6. merge tiers2_summ tiers2; by acct11 cd_no; run; data acct_tiers; set acct_tiers; if tier_x = '' and tier_w='' then delete; run; data tiers_&period2.(keep=acct11 year month cd_no cv_mon rocs cif market_product); set mast.mast_cm_canada; year=year(month); where (month)="&period2"d and market_product in ('Aeroplan/ Gold','Aeroplan/Platinum', 'Aeroplan/Elite Gold'); run; proc summary data=tiers_&period2. nway noprint missing; class acct11 cd_no month market_product cif ; output out=tiers2_&period2._summ (drop=_type_ _freq_) sum(rocs)= sum(cv_mon)=; run; proc sort data=acct_tiers; by acct11 cd_no; run; proc sort data=tiers2_&period2._summ; by acct11 cd_no; run; data tiers_&period2._cv(keep=tier_: cd_no acct11 market_product rocs cif cv_mon); merge tiers2_&period2._summ (in=a) acct_tiers (in=b); by acct11 cd_no; if a and b; run; /*inactive & active cif*/ proc summary data=tiers_&period2._cv nway noprint missing; class market_product tier_: cif; output out=product_&period2 (drop=_type_ rename=(_freq_ = cifs))sum(cv_mon)= sum(rocs)= ;
  • 7. run; /* find merchants*/ /* air canada*/ /*proc sql ; connect to sybase (user=user pass=pass server=IQAX) ; create table aircan as select * from connection to sybase ( select dba_nm, se10 from dbo.se_char ) where upcase(dba_nm) like ('AIR CANADA%'); quit;*/ %include '~/.sasnetrc' ; proc sql; connect to teradata (user=&tduser server=edw pass=&tdpass database=udw mode=teradata connection=global); create table aircan as select * from connection to teradata (select dba_nm, se10 from udw.se_char where dba_nm (NOT CASESPECIFIC) like ('AIR CANADA%') ); disconnect from teradata; quit; data aircan2; length senumber $10.; set aircan; where upcase(dba_nm) in ('AIR CANADA', 'AIR CANADA (EUROPE)', 'AIR CANADA (GLOBAL)', 'AIR CANADA IRELAND', 'AIR CANADA (LAC)', 'AIR CANADA (JAPA)', 'AIR CANADA (EMEA)', 'AIR CANADA (NORTH AMERICA)', 'AIR CANADA GUADALAJARA', 'AIR CANADA DENMARK', 'AIR CANADA FRANCE', 'AIR CANADA GERMANY', 'AIR CANADA ITALY', 'AIR CANADA NETHERLANDS'
  • 8. 'AIR CANADA NORWAY', 'AIR CANADA SPAIN', 'AIR CANADA SWEDEN', 'AIR CANADA SWITZERLAND', 'AIR CANADA CHINA', 'AIR CANADA EGYPT', 'AIR CANADA TAIWAN', 'AIR CANADA COSTA RICA', 'AIR CANADA CZECH', 'AIR CANADA HUNGARY', 'AIR CANADA MALAYSIA', 'AIR CANADA POLAND', 'AIR CANADA SAUDI', 'AIR CANADA SINGAPORE', 'AIR CANADA THAILAND', 'AIR CANADA SAUDI ARABIA', 'AIR CANADA BAHRAIN', 'AIR CANADA OMANI', 'AIR CANADA QATAR', 'AIR CANADA KUWAIT', 'AIR CANADA JORDAN', 'AIR CANADA AUSTRALIA', 'AIR CANADA JAPAN', 'AIR CANADA HONG KONG', 'AIR CANADA U.K.', 'AIR CANADA UAE', 'AIR CANADA, CANADA', 'AIR CANADA TURKEY', 'AIR CANADA - AUSTRALIA' 'AIR CANADA OSAKA', 'AIR CANADA SHANGHAI OFFICE', 'AIR CANADA SUC.ARGENTINA'); senumber=se10; run; /*Marriott*/ /*proc sql; connect to sybase (user=user pass=pass server=IQAX) ; create table marriott as select * from connection to sybase ( select dba_nm, se10, city, state_cd, country_cd from dbo.se_char ) where upcase(dba_nm) like ('%MARRIOTT HOTELS%') or upcase(dba_nm) like ('%JW MARRIOTT%') or upcase(dba_nm) like ('%RENAISSANCE HOTELS%') or
  • 9. upcase(dba_nm) like ('%COURTYARD BY MARRIOTT%') or upcase(dba_nm) like ('%RESIDENCE INN%') or upcase(dba_nm) like ('%SPRINGHILL SUITES%') or upcase(dba_nm) like ('%FAIRFIELD INN%') or upcase(dba_nm) like ('%TOWNEPLACE SUITES%'); quit;*/ proc sql; connect to teradata (user=&tduser server=edw pass=&tdpass database=udw mode=teradata connection=global); create table marriott as select * from connection to teradata ( select dba_nm, se10, city, state_cd, country_cd from udw.se_char where dba_nm (NOT CASESPECIFIC) like ('%MARRIOTT HOTELS%') or dba_nm (NOT CASESPECIFIC) like ('%JW MARRIOTT%') orf dba_nm (NOT CASESPECIFIC) like ('%RENAISSANCE HOTELS%') or dba_nm (NOT CASESPECIFIC) like ('%COURTYARD BY MARRIOTT%') or dba_nm (NOT CASESPECIFIC) like ('%RESIDENCE INN%') or dba_nm (NOT CASESPECIFIC) like ('%SPRINGHILL SUITES%') or dba_nm (NOT CASESPECIFIC) like ('%FAIRFIELD INN%') or dba_nm (NOT CASESPECIFIC) like ('%TOWNEPLACE SUITES%') ); disconnect from teradata; quit; proc sort data=marriott; by dba_nm; run; data marriott2; length senumber $10.; set marriott; where /*country_cd = '124' and*/ (city) not in ('NIAGARA FALLS', 'MONT TREMBLANT'); /*Marriott Canada only locations. Niagara Falls, ON, Mont Tremblant, Quebec are not part of the program*/
  • 10. senumber=se10; run; /*Avis Budget Group*/ /*proc sql; connect to sybase (user=user pass=pass server=IQAX) ; create table abg as select * from connection to sybase ( select dba_nm, se10, city, state_cd, country_cd from dbo.se_char ) where upcase(dba_nm) like ('%AVIS RENT%') or upcase(dba_nm) like('%BUDGET RENT%') or upcase(dba_nm) like('%AVIS BUDGET%'); quit; */ proc sql; connect to teradata (user=&tduser server=edw pass=&tdpass database=udw mode=teradata connection=global); create table abg as select * from connection to teradata ( select dba_nm, se10, city, state_cd, country_cd from udw.se_char where dba_nm (NOT CASESPECIFIC) like ('%AVIS RENT%') or dba_nm (NOT CASESPECIFIC) like ('%BUDGET RENT%') or dba_nm (NOT CASESPECIFIC) like ('%AVIS BUDGET%') ); disconnect from teradata; quit; data abg2; length senumber $10.; set abg; where country_cd in('840', '124'); /*US and Canadian Avis/Budget locations*/ senumber=se10; run; /*cobrand cids*/ proc summary data=aeroplan2_&period2. nway noprint missing; class cg_id product; output out=cobrand_cids_&period2. (drop=_type_ _freq_); where product = 'Cobrand'; run;
  • 11. /*canada & us cv*/ data canroc_&period2.; set canroc.trans_201412; /*define period2*/ where senumber not in ('0000000000','0000000001', '0000000002', '0000000003', ''); run; data usroc_&period2.; set usroc.trans_201412; /*define period2*/ where senumber not in ('0000000000','0000000001', '0000000002', '0000000003', ''); run; proc sort data=canroc_&period2.; by senumber; run; proc sort data=usroc_&period2.; by senumber; run; data roc_&period2; set usroc_&period2 canroc_&period2.; run; proc sort data=roc_&period2.; by senumber; run; /*aircanada*/ proc sort data=aircan2; by senumber; run; data ac_roc_&period2.(keep=cg_id procmon cv dba_nm); merge roc_&period2. (in=a) aircan2(in=b); by senumber; if a and b; run; proc summary data=ac_roc_&period2. nway noprint missing; class procmon cg_id;
  • 12. output out=ac_roc_summ_&period2. (drop=_type_ rename=(_freq_=rocs)) sum(cv)=; run; proc sort data=ac_roc_summ_&period2.; by cg_id; run; proc sort data=cobrand_cids_&period2.; by cg_id; run; data ac_cobrand_&period2.; merge ac_roc_summ_&period2. (in=a) cobrand_cids_&period2. (in=b); by cg_id; if a and b; run; proc summary data=ac_cobrand_&period2. nway noprint missing; class procmon; output out=ac_cobrand_&period2._summ (drop=_type_ _freq_)sum(rocs)=sum(cv)=; run; data ac_cobrand_&period2._summ; length partner $64.; partner="Air Canada"; set ac_cobrand_&period2._summ; run; /* avis budget group us & canada cv*/ proc sort data=roc_&period2.; by senumber; run; proc sort data=abg2; by senumber; run; data abg_roc_&period2.; merge roc_&period2. (in=a) abg2(in=b); by senumber; if a and b;
  • 13. run; proc summary data=abg_roc_&period2. nway noprint missing; class procmon cg_id; output out=abg_roc_&period2._summ (drop=_type_ rename=(_freq_=rocs)) sum(cv)=; run; proc sort data=abg_roc_&period2._summ; by cg_id; run; proc sort data=cobrand_cids_&period2; by cg_id; run; data abg_cobrand_&period2.; merge abg_roc_&period2._summ (in=a) cobrand_cids_&period2. (in=b); by cg_id; if a and b; run; proc summary data=abg_cobrand_&period2. nway noprint missing; class procmon; output out=abg_cobrand_&period2._summ (drop=_type_ _freq_)sum(rocs)= sum(cv)= ; run; data abg_cobrand_&period2._summ; length partner $64.; partner="Avis Budget Group"; set abg_cobrand_&period2._summ; run; /* marriott*/ proc sort data=marriott2; by senumber; run; data mar_roc_&period2.; merge canroc_&period2. (in=a) marriott2(in=b); by senumber; if a and b;
  • 14. run; proc summary data=mar_roc_&period2. nway noprint missing; class procmon cg_id; output out=mar_roc_&period2._summ (drop=_type_ rename=(_freq_ = rocs)) sum(cv)=; run; proc sort data=canroc_&period2.; by cg_id; run; proc sort data=mar_roc_&period2._summ; by cg_id; run; proc sort data=cobrand_cids_&period2.; by cg_id; run; data mar_cobrand_&period2.; merge mar_roc_&period2._summ (in=a) cobrand_cids_&period2. (in=b); by cg_id; if a and b; run; proc summary data=mar_cobrand_&period2. nway noprint missing; class procmon; output out=mar_cobrand_&period2._summ (drop=_type_ _freq_)sum(rocs)=sum(cv)=; run; data mar_cobrand_&period2._summ; length partner $64.; partner="Marriott"; set mar_cobrand_&period2._summ; run; /* combine partners*/ libname aerolib "/iim/corp3/2014032_kmille_aeroplan"; data partners_cv (drop=rocs metric partner); length metric label $64.; set ac_cobrand_&period2._summ
  • 15. abg_cobrand_&period2._summ mar_cobrand_&period2._summ; metric='cv'; label=strip(partner)||"_"||strip(metric); run; data partners_rocs (drop=cv metric partner); length metric label $64.; set ac_cobrand_&period2._summ abg_cobrand_&period2._summ mar_cobrand_&period2._summ; metric='rocs'; label=strip(partner)||"_"||strip(metric); run; proc transpose data=partners_cv out=partners_cv(drop=_:) ; by label; id procmon; var cv; run; proc transpose data=partners_rocs out=partners_rocs(drop=_:) ; by label; id procmon; var rocs; run; data combined_&period2.; set partners_rocs partners_cv; run; /*combine acct status*/ data cv_summ(drop=currrocs_cobrand currcifs_cobrand accounts type metric); length metric label $64.; format month mmddyy10.; set acct_summ; metric = 'cv'; label=strip(type)||"_"||strip(metric); month = "&period2"d; run; data rocs_summ(drop=currcv_cobrand currcifs_cobrand accounts type metric); length metric label$64.;
  • 16. format month mmddyy10.; set acct_summ; metric='rocs'; label=strip(type)||"_"||strip(metric); month = "&period2"d; run; data cifs_summ(drop=currcv_cobrand currrocs_cobrand accounts type metric); length metric $64.; format month mmddyy10.; set acct_summ; metric='cifs'; label=strip(type)||"_"||strip(metric); month = "&period2"d; run; data accounts_summ(drop=currcv_cobrand currrocs_cobrand currcifs_cobrand type metric); length metric $64.; format month mmddyy10.; set acct_summ; metric='accounts'; label=strip(type)||"_"||strip(metric); month = "&period2"d; run; proc transpose data=cv_summ out=cv_summ(drop=_:) ; by label; id month; var currcv_cobrand; run; proc transpose data=rocs_summ out=rocs_summ(drop=_:) ; by label; id month; var currrocs_cobrand; run; proc transpose data=cifs_summ out=cifs_summ(drop=_:) ; by label; id month; var currcifs_cobrand; run; proc transpose data=accounts_summ out=accounts_summ(drop=_:) ;
  • 17. by label; id month; var accounts; run; data combined2_&period2.; set cv_summ rocs_summ cifs_summ accounts_summ combined_&period2; run; /*combine product*/ data product_cv_summ(drop=cifs rocs metric market_product tier_w tier_x cif); length metric label $64.; format month mmddyy10.; set product_&period2.; metric = 'cv'; label=strip(market_product)||"_"||strip(metric)||"_"|| strip(tier_w)||"_"||strip(tier_x)||"_"||strip(cif); month = "&period2"d; run; data product_cifs_summ(drop=cv_mon rocs metric market_product tier_w tier_x cif); length metric $64.; format month mmddyy10.; set product_&period2.; metric = 'cifs'; label=strip(market_product)||"_"||strip(metric)||"_"|| strip(tier_w)||"_"||strip(tier_x)||"_"||strip(cif); month = "&period2"d; run; data product_rocs_summ(drop=cv_mon cifs metric market_product tier_w tier_x cif); length metric $64.; format month mmddyy10.; set product_&period2.; metric = 'rocs'; label=strip(market_product)||"_"||strip(metric)||"_"|| strip(tier_w)||"_"||strip(tier_x)||"_"||strip(cif); month = "&period2"d; run; proc transpose data=product_cv_summ out=product_cv_summ2(drop=_:) ;
  • 18. by label; id month; var cv_mon; run; proc transpose data=product_cifs_summ out=product_cifs_summ2(drop=_:) ; by label; id month; var cifs; run; proc transpose data=product_rocs_summ out=product_rocs_summ2(drop=_:) ; by label; id month; var rocs; run; data aerolib.combined3_&period2.; set product_cv_summ2 product_rocs_summ2 product_cifs_summ2 combined2_&period2; run; /*monthly*/ proc sort data=aerolib.combined3_01jan2014; by label; run; proc sort data=aerolib.combined3_01feb2014; by label; run; proc sort data=aerolib.combined3_01mar2014; by label; run; proc sort data=aerolib.combined3_01apr2014; by label; run; proc sort data=aerolib.combined3_01may2014; by label; run;
  • 19. proc sort data=aerolib.combined3_01jun2014; by label; run; proc sort data=aerolib.combined3_01jul2014; by label; run; proc sort data=aerolib.combined3_01aug2014; by label; run; proc sort data=aerolib.combined3_01sep2014; by label; run; proc sort data=aerolib.combined3_01oct2014; by label; run; proc sort data=aerolib.combined3_01nov2014; by label; run; proc sort data=aerolib.combined3_01dec2014; by label; run; data aerolib.final; merge aerolib.combined3_01JAN2014 aerolib.combined3_01FEB2014 aerolib.combined3_01MAR2014 aerolib.combined3_01APR2014 aerolib.combined3_01MAY2014 aerolib.combined3_01JUN2014 aerolib.combined3_01JUL2014 aerolib.combined3_01AUG2014 aerolib.combined3_01SEP2014 aerolib.combined3_01OCT2014 aerolib.combined3_01NOV2014 aerolib.combined3_01DEC2014; by label; run;
  • 20.   Kenneth Miller ------------------------------------- Corporate Insight and Analytics | RIM Global Corporate Payments AEDR - Phoenix Email: kenneth.miller1@aexp.com | Office: 602.537.9687   American Express made the following annotations "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." American Express a ajouté le commentaire suivant le Ce courrier et toute pièce jointe qu'il contient sont réservés au seul destinataire indiqué et peuvent renfermer des renseignements confidentiels et privilégiés. Si vous n'êtes pas le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pièce jointe est interdite. Si vous avez reçu cette communication par erreur, veuillez nous en aviser par courrier et détruire immédiatement le courrier et les pièces jointes. Merci.