This document contains SAS code to analyze transaction data from two time periods to categorize customer accounts into different segments. It cleans and transforms transaction data, joins additional data on customer tiers, and identifies key merchant categories like Air Canada and Marriott. The code then summarizes metrics like spend by customer segment and merchant to produce output for analysis.
As presented at Dutch PHP Conference 2015, an introduction to command buses, how to implement your own in PHP and why they're both useful but unimportant.
Closing keynote, as presented at Codemotion 2014, LaraconEU 2014, Redevelop 2014, CodeConnexx 2013 and PHP North East 2014.
This presentation makes a reference to a reading list I received. For those interested, the release consists of most of the general classics, such as Gang Of Four "Design Patterns", The Pragmatic Programmer, Structure and Interpretation of Computer Programs, Domain Driven Design and a few others. The actual list remains tucked away in a box somewhere.
As presented at Dutch PHP Conference 2015, an introduction to command buses, how to implement your own in PHP and why they're both useful but unimportant.
Closing keynote, as presented at Codemotion 2014, LaraconEU 2014, Redevelop 2014, CodeConnexx 2013 and PHP North East 2014.
This presentation makes a reference to a reading list I received. For those interested, the release consists of most of the general classics, such as Gang Of Four "Design Patterns", The Pragmatic Programmer, Structure and Interpretation of Computer Programs, Domain Driven Design and a few others. The actual list remains tucked away in a box somewhere.
Models and Service Layers, Hemoglobin and HobgoblinsRoss Tuck
As presented at ZendCon 2014, AmsterdamPHP, PHPBenelux 2014, Sweetlake PHP and PHP Northwest 2013, an overview of some different patterns for integrating and managing logic throughout your application.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
Design Patterns avec PHP 5.3, Symfony et PimpleHugo Hamon
Cette conférence présente deux grands motifs de conception : l'observateur et l'injection de dépendance. Ce sujet allie à la fois théorie et pratique. Le composant autonome EventDispatcher de Symfony ainsi que le conteneur d'injection de dépendance Pimple sont mis à l'honneur avec des exemples pratiques d'usage. Ces cas pratiques combinent du code de l'ORM Propel ainsi que le composant autonome Zend\Search\Lucene du Zend Framework 2
Persistence is one of the most important part in a PHP project. Persisting data to a database came with PHP/FI and its MySQL support. From native extensions and PHP4 database abstraction libraries to PDO and modern ORM frameworks, you will (re)discover how persistence has evolved during the last decade. This talk will also introduce the future of data persistence with the growing success of alternative storage engines.
Silex is a brand new PHP 5.3 micro framework built on top of the Symfony2 de decoupled components. In this session, we will discover how to build and deploy powerful REST web services with such a micro framework and its embedded tools.
The first part of this talk will introduce the basics of the REST architecture. We fill focus on the main concepts of REST like HTTP methods, URIs and open formats like XML and JSON.
Then, we will discover how to deploy REST services using most of interesting Silex tools like database abstraction layer, template engine and input validation. We will also look at unit and functional testing frameworks with PHPUnit and HTTP caching with Edge Side Includes and Varnish support to improve performances.
Have you ever wondered how all this CQRS / ES concepts could be applied to a PHP project? Let's take a look at some code of our last project: a warehouse management system.
This talk will show how we understand DDD and how we apply it at Ulabox, what changes in application's architecture and code when we apply CQRS and how to deal with event sourcing, when there're no persisted entities, only events that generate projections used in the read model.
Speaker: Manel Sellés (@manelselles), software engineer, DDD-TDD fan and Symfony Expert Certified by Sensiolabs. Currently developing enterprise logistics software at Ulabox.com
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
Models and Service Layers, Hemoglobin and HobgoblinsRoss Tuck
As presented at ZendCon 2014, AmsterdamPHP, PHPBenelux 2014, Sweetlake PHP and PHP Northwest 2013, an overview of some different patterns for integrating and managing logic throughout your application.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
Design Patterns avec PHP 5.3, Symfony et PimpleHugo Hamon
Cette conférence présente deux grands motifs de conception : l'observateur et l'injection de dépendance. Ce sujet allie à la fois théorie et pratique. Le composant autonome EventDispatcher de Symfony ainsi que le conteneur d'injection de dépendance Pimple sont mis à l'honneur avec des exemples pratiques d'usage. Ces cas pratiques combinent du code de l'ORM Propel ainsi que le composant autonome Zend\Search\Lucene du Zend Framework 2
Persistence is one of the most important part in a PHP project. Persisting data to a database came with PHP/FI and its MySQL support. From native extensions and PHP4 database abstraction libraries to PDO and modern ORM frameworks, you will (re)discover how persistence has evolved during the last decade. This talk will also introduce the future of data persistence with the growing success of alternative storage engines.
Silex is a brand new PHP 5.3 micro framework built on top of the Symfony2 de decoupled components. In this session, we will discover how to build and deploy powerful REST web services with such a micro framework and its embedded tools.
The first part of this talk will introduce the basics of the REST architecture. We fill focus on the main concepts of REST like HTTP methods, URIs and open formats like XML and JSON.
Then, we will discover how to deploy REST services using most of interesting Silex tools like database abstraction layer, template engine and input validation. We will also look at unit and functional testing frameworks with PHPUnit and HTTP caching with Edge Side Includes and Varnish support to improve performances.
Have you ever wondered how all this CQRS / ES concepts could be applied to a PHP project? Let's take a look at some code of our last project: a warehouse management system.
This talk will show how we understand DDD and how we apply it at Ulabox, what changes in application's architecture and code when we apply CQRS and how to deal with event sourcing, when there're no persisted entities, only events that generate projections used in the read model.
Speaker: Manel Sellés (@manelselles), software engineer, DDD-TDD fan and Symfony Expert Certified by Sensiolabs. Currently developing enterprise logistics software at Ulabox.com
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
Adding Statistical Functionality to the DATA Step with PROC FCMPJacques Rioux
Extend and reuse SAS own procedures within data step code. Using PROC FCMP, we show you can create reusable code in the data step to pull together the power of possibly many procedures and getting a much cleaner programming model.
Starting with the system calll "getrusage", this returns synchronous, process-level information, mainly max RSS used. This talk describes the output from getrusage, the rusage formatting utility in ProcStats, and several examples of using it to examine time and memory use.
Optional first & final outputs to give baseline and total status, differencing avoids extraneous output, and user messages allow arbitrary stat's and tracking content.
The combination makes this nice for tracking both long-lived and shorter, more intensive processing.
PostgreSQL Procedural Languages: Tips, Tricks and GotchasJim Mlodgenski
One of the most powerful features of PostgreSQL is its diversity of procedural languages, but with that diversity comes a lot of options.
Did you ever wonder:
- What all of those options are on the CREATE FUNCTION statement?
- How do they affect my application?
- Does my choice of procedural language affect the performance of my statements?
- Should I create a single trigger with IF statements or several simple triggers?
- How do I debug my code?
- Can I tell which line in my function is taking all of the time?
SAS codes and tricks Comprehensive all codessrizrazariz
https://www.dropbox.com/sh/s12ibnz9e14sn7d/AADmeewvF8Q2gfHwRMKMd_Jda?dl=0
sas useful codes and tricks
https://www.dropbox.com/sh/s12ibnz9e14sn7d/AADmeewvF8Q2gfHwRMKMd_Jda?dl=0
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.