├── 01 Init.sas ├── 01 Libname and Copy.sas ├── 02 DSCS Macros.sas ├── Chapter 01.sas ├── Chapter 02.sas ├── Chapter 03.sas ├── Chapter 04.sas ├── Chapter 05.sas ├── Chapter 06.sas ├── Chapter 07.sas ├── Chapter 08.sas ├── Chapter 09.sas ├── Chapter 10.sas ├── Chapter 11.sas ├── Chapter 12.sas ├── Chapter 13.sas ├── Chapter 14.sas ├── Chapter 15.sas ├── Chapter 16.sas ├── Chapter 17.sas ├── Chapter 18.sas ├── Chapter 19.sas ├── Chapter 20.sas ├── Chapter 21.sas ├── Chapter 22.sas ├── Chapter 23.sas ├── Chapter 24.sas ├── Chapter 25.sas ├── Chapter 26.sas ├── Chapter 27.sas ├── Chapter 28 - Monopoly Formats.sas ├── Chapter 28 - MonopolySimulation Macro.sas ├── Chapter 28.sas ├── Color Graphs ├── DSCS_f10p10.jpg ├── DSCS_f10p11.jpg ├── DSCS_f14p3.jpg ├── DSCS_f14p4.jpg ├── DSCS_f14p5.jpg ├── DSCS_f16p1.jpg ├── DSCS_f17p1.jpg ├── DSCS_f1p4.jpg ├── DSCS_f20p10.jpg ├── DSCS_f20p11.jpg ├── DSCS_f21p6.jpg ├── DSCS_f21p7.jpg ├── DSCS_f21p8.jpg ├── DSCS_f27p1.png ├── DSCS_f27p2.png ├── DSCS_f27p3.png ├── DSCS_f27p4.png ├── DSCS_f27p5.png ├── DSCS_f27p6.jpg ├── DSCS_f28p1.jpg ├── DSCS_f2p1.jpg ├── DSCS_f2p2.jpg ├── DSCS_f2p3.jpg ├── DSCS_f2p4.jpg ├── DSCS_f2p5.jpg ├── DSCS_f2p6.jpg ├── DSCS_f2p7.jpg ├── DSCS_f2p8.jpg ├── DSCS_f2p9.jpg ├── DSCS_f3p2.jpg ├── DSCS_f4p4.png ├── DSCS_f4p7.jpg ├── DSCS_f5p2.jpg ├── DSCS_f5p3.jpg ├── DSCS_f6p1.jpg ├── DSCS_f6p4.jpg ├── DSCS_f6p5.jpg ├── DSCS_f6p7.jpg ├── DSCS_f6p9.jpg ├── DSCS_f8p2.jpg ├── DSCS_f8p3.jpg ├── DSCS_f8p4.jpg ├── DSCS_f9p2.jpg ├── DSCS_f9p4.jpg ├── DSCS_f9p5.jpg ├── DSCS_f9p6.jpg ├── DSCS_o28p1.jpg └── DSCS_o28p2.jpg ├── DSCS_Cover_klein.jpg ├── README.md ├── SAS Dataset as SAS-Programm ├── CREATE_DATA_airlinepassengerssmooth.sas ├── CREATE_DATA_bank.sas ├── CREATE_DATA_claims_nodup.sas ├── CREATE_DATA_employees.sas ├── CREATE_DATA_flights_911.sas ├── CREATE_DATA_manfc.sas ├── CREATE_DATA_material.sas ├── CREATE_DATA_patients.sas ├── CREATE_DATA_patients_recruitment.sas ├── CREATE_DATA_product_base.sas ├── CREATE_DATA_product_demand.sas ├── CREATE_DATA_projects.sas ├── CREATE_DATA_property_costrevenue.sas ├── CREATE_DATA_sales_eur.sas ├── CREATE_DATA_sales_historic.sas ├── CREATE_DATA_sales_month.sas ├── CREATE_DATA_sales_targetratios.sas ├── CREATE_DATA_statfc.sas └── CREATE_DATA_transactions.sas ├── SAS Datasets as Windows_sas7bdat ├── airlinepassengerssmooth.sas7bdat ├── bank.sas7bdat ├── claims_nodup.sas7bdat ├── employees.sas7bdat ├── flights_911.sas7bdat ├── manfc.sas7bdat ├── material.sas7bdat ├── patients.sas7bdat ├── patients_recruitment.sas7bdat ├── product_base.sas7bdat ├── product_demand.sas7bdat ├── projects.sas7bdat ├── property_costrevenue.sas7bdat ├── sales_eur.sas7bdat ├── sales_historic.sas7bdat ├── sales_month.sas7bdat ├── sales_targetratios.sas7bdat ├── statfc.sas7bdat └── transactions.sas7bdat ├── SAS Enterprise Guide Project (with programs and datasets) └── ApplyingDataScience_FullSASContent_V1.egp └── cover.jpg /01 Init.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | ods graphics on; 4 | 5 | -------------------------------------------------------------------------------- /01 Libname and Copy.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | libname datasci "c:\tmp\ApplyingDataScience_Data"; 5 | 6 | proc copy in=datasci out=work; 7 | run; -------------------------------------------------------------------------------- /02 DSCS Macros.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | *** Availabe Macros 4 | 5 | %VAREXIST 6 | %DETECT_BRKPOINT 7 | %REPLACE_MV 8 | %CALC_REFERENCE_CATEGORY 9 | ; 10 | 11 | 12 | 13 | %macro varexist 14 | /*** copied from https://communities.sas.com/message/149819 3.9.2014 ***/ 15 | 16 | /*---------------------------------------------------------------------- 17 | Check for the existence of a specified variable. 18 | ----------------------------------------------------------------------*/ 19 | (ds /* Data set name */ 20 | ,var /* Variable name */ 21 | ); 22 | /*---------------------------------------------------------------------- 23 | Usage Notes: 24 | %if %varexist(&data,NAME) 25 | %then %put input data set contains variable NAME; 26 | The macro calls resolves to 0 when either the data set does not exist 27 | or the variable is not in the specified data set. 28 | ----------------------------------------------------------------------*/ 29 | %local dsid rc ; 30 | %*---------------------------------------------------------------------- 31 | Use SYSFUNC to execute OPEN, VARNUM, and CLOSE functions. 32 | -----------------------------------------------------------------------; 33 | %let dsid = %sysfunc(open(&ds)); 34 | %if (&dsid) %then %do; 35 | %if %sysfunc(varnum(&dsid,&var)) %then 1; 36 | %else 0 ; 37 | %let rc = %sysfunc(close(&dsid)); 38 | %end; 39 | %else 0; 40 | %mend varexist; 41 | 42 | 43 | 44 | 45 | 46 | %macro DetectBrkPoint(data=,target=,date=,maxbasis=, 47 | plot=LINE, formatdate=YES, format=8., 48 | reflinesfile = c:/tmp/reflines.sas); 49 | 50 | proc sort data=&data out=&data._sort; 51 | by &date; 52 | run; 53 | 54 | proc adaptivereg data=&data._sort plots=all details=bases ; 55 | model &target = &date %if &maxbasis ne %then %do; / maxbasis=&maxbasis %end; ; 56 | ods output BWDParams=KnotPoints; 57 | output out=&data._&target._adpt predicted=pred_&target.; 58 | run; 59 | 60 | data KnotPoints; 61 | set KnotPoints; 62 | %IF &formatdate = YES %THEN %DO; format knot date9.; %END; 63 | run; 64 | 65 | proc print data=KnotPoints;run; 66 | 67 | filename reflines "&tmpfile"; 68 | data _NULL_; 69 | set KnotPoints; 70 | where upcase(variable) ne 'INTERCEPT'; 71 | format knot &format.; 72 | file reflines; 73 | put @04 "refline " knot " / axis = x;"; 74 | run; 75 | 76 | proc sgplot data=&data._&target._adpt; 77 | series x=&date y=pred_&target.; 78 | %if %upcase(&plot) = LINE %then %do; series x=&date y=⌖ %end; 79 | %else %if %upcase(&plot) = SCATTER %then %do; scatter x=&date y=⌖ %end; 80 | %include reflines; 81 | run; 82 | 83 | %mend; 84 | 85 | 86 | 87 | 88 | 89 | %MACRO REPLACE_MV(cols,mv=.,rplc=0); 90 | ARRAY varlist {*} &cols; 91 | DO _i = 1 TO dim(varlist); 92 | IF varlist{_i} = &mv THEN varlist{_i}=&rplc; 93 | END; 94 | DROP _i; 95 | %MEND; 96 | 97 | 98 | 99 | 100 | %macro CALC_REFERENCE_CATEGORY (ParmEst = ParameterEstimates, 101 | ClassLevels = ClassLevelInfo, 102 | OutputDS = _ParmEst_XT_, 103 | Proc = GLMSELECT) 104 | / minoperator; 105 | 106 | 107 | ************************************************************************************************** 108 | ** Version 2.1: 109 | 110 | 2020-04-01: Publication at SAS Communities 111 | 2020-02-25: 112 | - Adopting for PHREG output: 113 | -- Adding a MODE Variable to differentiate between different output formats of the PROCS 114 | -- MODE Currently allows: GLMSELECT, LOGISITC, PHREG, PHSELECT, LOGSELECT, GENSELECT, REGSELECT 115 | - Fixing a problem that class values not to be sorted so that the REFERENCE Category appears at end 116 | ** Version 1.1: 2016 117 | A first version of this macro has originally been published in my in chapter 12 of my SAS Press book, 118 | "Applying Data Science - Business Case Studies Using SAS," ; 119 | **************************************************************************************************; 120 | 121 | **************************************************************; 122 | *** Prepare the KEEP statement for each procedure; 123 | **************************************************************; 124 | %if %upcase(&PROC.) IN (LOGSELECT PHSELECT GENSELECT ) %then %let KeepVarStat = StdErr ChiSq ProbChiSq; 125 | %else %if %upcase(&PROC.) = LOGISTIC %then %let KeepVarStat = StdErr WaldChiSq ProbChiSq; 126 | %else %if %upcase(&PROC.) = PHREG %then %let KeepVarStat = StdErr ChiSq ProbChiSq HazardRatio; 127 | %else %if %upcase(&PROC.) = REGSELECT %then %let KeepVarStat = StdErr tValue Probt; 128 | %ELSE %if %upcase(&PROC.) = GLMSELECT %then %let KeepVarStat = StandardizedEst StdErr tValue Probt; 129 | 130 | **************************************************************; 131 | *** ENUMERATE THE EFFECTS IN THE DATA; 132 | **************************************************************; 133 | data _ParmEst_; 134 | length Parameter $32; 135 | set &ParmEst; 136 | %if %varexist(&ParmEst, step) AND %upcase(&PROC.) NE PHREG %then %do; if step ne . then delete; %end; 137 | %if &PROC. = PHSELECT %then %do; Effect = scan(Parameter,1); %end; 138 | %if %upcase(&PROC.) IN (GLMSELECT PHSELECT REGSELECT LOGSELECT GENSELECT) %then %do; 139 | Parameter = strip(Parameter); 140 | Variable = scan(parameter,1); 141 | ClassLevel = scan(parameter,2); 142 | keep Effect Parameter Estimate ClassLevel Variable &KeepVarStat. PosVar; 143 | %end; 144 | %else %if %upcase(&PROC.) = LOGISTIC %then %do; 145 | rename ClassVal0 = ClassLevel; 146 | Effect = Variable; 147 | Parameter = catx(" ",effect,ClassVal0); 148 | keep Effect Parameter Estimate ClassVal0 Variable &KeepVarStat. PosVar; 149 | %end; 150 | %else %if %upcase(&PROC.) = PHREG %then %do; 151 | Variable = Parameter; 152 | Effect = Variable; 153 | rename ClassVal0 = ClassLevel; 154 | Parameter = catx(" ",effect,strip(ClassVal0)); 155 | keep Effect Parameter Estimate ClassVal0 Variable &KeepVarStat. PosVar; 156 | %end; 157 | lag_effect = lag(effect); 158 | if effect ne lag_effect then PosVar + 1; 159 | run; 160 | 161 | **************************************************************; 162 | *** Split the CLASS and the INTERVAL Variables; 163 | **************************************************************; 164 | data _ParmEstClass_ 165 | _ParmEstInt_; 166 | set _ParmEst_; 167 | if ClassLevel = "" then output _ParmEstInt_; 168 | else output _ParmEstClass_; 169 | run; 170 | 171 | **************************************************************; 172 | *** Receiving and Scanning the Names of all Categories; 173 | **************************************************************; 174 | %if %upcase(&Proc.) IN (GLMSELECT PHSELECT REGSELECT LOGSELECT GENSELECT) %then %do; 175 | data _ClassLevelsList_(rename=(class=Variable)); 176 | set &ClassLevels; 177 | drop i levels values; 178 | do i = 1 to levels; 179 | ClassLevel = scan(values,i); 180 | ClassID + 1; 181 | output; 182 | end; 183 | run; 184 | %end; %* GLMSELECT Mode; 185 | %ELSE %IF %upcase(&Proc.) IN (LOGISTIC PHREG) %then %do; 186 | data _ClassLevelsList_(rename=(Class=Variable)); 187 | set &ClassLevels; 188 | keep Class Value ClassID; 189 | rename Value=ClassLevel; 190 | format class_tmp $32.; 191 | retain class_tmp "" ClassID 0; 192 | if Class ne "" then do; 193 | class_tmp = class; 194 | ClassID+1; 195 | end; 196 | else Class = class_tmp; 197 | run; 198 | %end; %* LOGISTIC/PHREG Mode; 199 | 200 | 201 | **************************************************************; 202 | *** Remove Unused Class Variables; 203 | **************************************************************; 204 | proc sql; 205 | delete from _ClassLevelsList_ 206 | where variable not in (select distinct variable from _ParmEstClass_); 207 | quit; 208 | 209 | 210 | **************************************************************; 211 | *** Create a MasterTable; 212 | **************************************************************; 213 | proc sql; 214 | create table _ParmEstClass_XT_ 215 | as select a.*, b.* 216 | from _ClassLevelsList_ as a 217 | full join _ParmEstClass_ as b 218 | on a.variable = b.variable 219 | and a.ClassLevel = b.ClassLevel 220 | order by variable, classid; 221 | quit; 222 | 223 | 224 | *** 2020-02-25: Adding a Sort to make sure that the reference category is the last record for each 225 | variable group. By Default REF = LAST so in that case it would work anyhow. However 226 | if you specifc REF = FIRST or another REF-value the default assumption is to given 227 | and a sorting is needed 228 | Sorting with the DESCENDING option for ESTIMATE this orders 229 | the MISSING Value (= Reference Category) at the end of the group; 230 | ; 231 | 232 | proc sort data=_ParmEstClass_XT_; 233 | by variable descending Estimate ; 234 | run; 235 | 236 | 237 | 238 | **************************************************************; 239 | *** Calculae the estimates for the reference category; 240 | **************************************************************; 241 | data _ParmEstClass_XT_(drop=cum_coeff lag_PosVar ClassID); 242 | set _ParmEstClass_XT_; 243 | by variable; 244 | lag_PosVar = lag(PosVar); 245 | if first.variable then cum_coeff = estimate; 246 | else cum_coeff + estimate; 247 | if estimate = . then do; 248 | estimate = -cum_coeff; 249 | PosVar = lag_PosVar; 250 | end; 251 | run; 252 | 253 | 254 | **************************************************************; 255 | *** Create the final dataset; 256 | **************************************************************; 257 | data &OutputDS; 258 | set _ParmEstClass_XT_ _ParmEstInt_; 259 | if effect = "" then do; 260 | effect = variable; 261 | parameter = catx(' ',variable,classlevel); end; 262 | drop variable classlevel; 263 | run; 264 | 265 | proc sort data=&OutputDS; by PosVar ;run; 266 | proc print data=&OutputDS; 267 | var effect parameter estimate &KeepVarStat. ; 268 | run; 269 | 270 | proc delete data=_ParmEstClass_XT_ _ParmEstClass_ _ParmEstInt_ _ClassLevelsList_ _ParmEst_; run; 271 | 272 | %mend; 273 | 274 | 275 | -------------------------------------------------------------------------------- /Chapter 01.sas: -------------------------------------------------------------------------------- 1 | 2 | proc lifetest data=employees ; 3 | time Duration*Status(1); 4 | where Department='SALES_ENGINEER'; 5 | run; 6 | 7 | 8 | proc lifetest data=employees ; 9 | time Duration*Status(1); 10 | where Department='SALES_ENGINEER'; 11 | ods select quartiles means; 12 | run; 13 | 14 | 15 | 16 | 17 | proc lifetest data=employees ; 18 | time Duration*Status(1); 19 | where Department='SALES_ENGINEER'; 20 | run; 21 | 22 | 23 | 24 | 25 | proc lifetest data=employees ; 26 | time Duration*Status(1); 27 | ods select ProductLimitEstimates; 28 | run; 29 | 30 | 31 | 32 | 33 | proc lifetest data=employees ; 34 | time Duration*Status(1); 35 | ods select SurvivalPlot; 36 | run; 37 | 38 | 39 | 40 | proc lifetest data=employees ; 41 | time Duration*Status(1); 42 | ods select quartiles means CensoredSummary; 43 | run; 44 | 45 | 46 | 47 | 48 | PROC LIFETEST DATA=employees PLOTS=survival(ATRISK=0 to 120 by 12) ; 49 | TIME Duration*Status(1); 50 | RUN; 51 | 52 | 53 | *** 1.6.2; 54 | 55 | 56 | PROC LIFETEST DATA=employees PLOTS=(survival(cl)); 57 | TIME Duration*Status(1); 58 | RUN; 59 | 60 | 61 | 62 | 63 | *** 1.7; 64 | 65 | PROC LIFETEST DATA=employees plots=(hazard(bandwidth=3)) maxtime=120; 66 | TIME Duration*Status(1); 67 | RUN; 68 | 69 | 70 | 71 | PROC LIFETEST DATA=employees plots=(hazard(bandwidth=3)) maxtime=120; 72 | TIME Duration*Status(1); 73 | where Department='SALES_ENGINEER'; 74 | RUN; 75 | 76 | 77 | *** 1.8; 78 | 79 | 80 | PROC LIFETEST DATA=employees 81 | METHOD=LIFE INTERVALS=0 to 120 by 6 ; 82 | TIME Duration*Status(1); 83 | ods select lifetableestimates; 84 | RUN; 85 | 86 | 87 | 88 | PROC LIFETEST DATA=employees 89 | METHOD=LIFE INTERVALS=0 to 120 by 6 ; 90 | TIME Duration*Status(1); 91 | ods select survivalplot; 92 | RUN; 93 | 94 | 95 | 96 | 97 | PROC LIFETEST DATA=employees OUTSURV = SurvTable; 98 | TIME Duration*Status(1); 99 | RUN; 100 | -------------------------------------------------------------------------------- /Chapter 02.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | *** 2.2; 4 | 5 | proc means data=employees mean; 6 | class Department; 7 | var Duration ; 8 | run; 9 | 10 | 11 | 12 | PROC LIFETEST DATA=employees; 13 | ODS select SurvivalPlot; 14 | TIME Duration*Status(1); 15 | STRATA department; 16 | RUN; 17 | 18 | 19 | 20 | 21 | proc lifetest data=employees; 22 | time duration*status(1); 23 | strata department; 24 | ods select homtests ; 25 | where department in ("TECH_SUPPORT", "SALES_ENGINEER", "ADMINSTRATION"); 26 | run; 27 | 28 | 29 | 30 | 31 | proc lifetest data=employees; 32 | time duration*status(1); 33 | strata department; 34 | ods select survivalplot; 35 | where department in ("TECH_SUPPORT", "SALES_ENGINEER", "ADMINSTRATION"); 36 | run; 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | proc lifetest data=employees outsurv = work.survplot 46 | plots=(hazard(bandwidth=3 maxtime=120) survival(cb=hw)); 47 | time duration*status(1); 48 | strata department; 49 | where department in ("SALES_REP", "SALES_ENGINEER"); 50 | ods select homtests ; 51 | run; 52 | 53 | 54 | 55 | 56 | proc lifetest data=employees outsurv = work.survplot 57 | plots=(hazard(bandwidth=3 maxtime=120) survival(cb=hw)); 58 | time duration*status(1); 59 | strata department; 60 | where department in ("SALES_REP", "SALES_ENGINEER"); 61 | ods select survivalplot ; 62 | run; 63 | 64 | 65 | 66 | 67 | 68 | proc lifetest data=employees outsurv = work.survplot 69 | plots=(hazard(bandwidth=3 maxtime=120) survival(cb=hw)); 70 | time duration*status(1); 71 | strata department; 72 | where department in ("SALES_REP", "SALES_ENGINEER"); 73 | ods select hazardplot; 74 | run; 75 | 76 | 77 | 78 | *** 2.3; 79 | 80 | proc lifetest data=employees; 81 | time duration*status(1); 82 | strata gender; 83 | ods select homtests survivalplot; 84 | run; 85 | 86 | 87 | 88 | proc lifetest data=employees plots=(survival(cb=hw)); 89 | time duration*status(1); 90 | strata TechKnowHow; 91 | ods select homtests survivalplot; 92 | run; 93 | 94 | 95 | 96 | proc lifetest data=employees; 97 | time duration*status(1); 98 | strata TechKnowHow; 99 | where department='TECH_SUPPORT'; 100 | ods select homtests survivalplot; 101 | run; 102 | 103 | 104 | 105 | 106 | 107 | proc lifetest data=employees; 108 | time duration*status(1); 109 | strata startperiod; 110 | ods select homtests survivalplot; 111 | run; 112 | 113 | 114 | 115 | *** 2.4; 116 | 117 | PROC PHREG DATA=Employees; 118 | CLASS department gender TechKnowHow / PARAM=effect REF=first; 119 | MODEL Duration*Status(1)= department gender TechKnowHow / SELECTION=stepwise; 120 | ods select ClassLevelInfo; 121 | RUN; 122 | 123 | 124 | 125 | 126 | 127 | proc phreg data=employees; 128 | ods select ParameterEstimates; 129 | CLASS department gender TechKnowHow / PARAM=effect REF=first; 130 | MODEL Duration*Status(1)= department gender TechKnowHow / SELECTION=stepwise; 131 | run; 132 | 133 | 134 | 135 | 136 | proc phreg data=employees; 137 | ods select ParameterEstimates; 138 | class department gender techknowhow / param=effect ref=first; 139 | model duration*status(1)= department; 140 | run; 141 | 142 | 143 | 144 | 145 | *** 2.4.3; 146 | 147 | PROC PHREG DATA=Employees EV; 148 | ods select ExplainedVariation; 149 | CLASS department gender TechKnowHow/ PARAM=effect REF=first; 150 | MODEL Duration*Status(1)= department gender TechKnowHow; 151 | RUN; 152 | 153 | 154 | 155 | *** 2.4.4; 156 | proc lifetest data=employees outsurv=survivaldata; 157 | time duration*status(1); 158 | strata department; 159 | run; 160 | 161 | PROC PHREG DATA=Employees outest = ParamEstimates; 162 | CLASS department gender TechKnowHow StartPeriod/ PARAM=effect REF=first; 163 | MODEL Duration*Status(1)= department gender / SELECTION=stepwise; 164 | OUTPUT OUT=surv_pred survival=SurvPred 165 | Atrisk =ObsAtRsik 166 | LD =DisplacmLikelihood; 167 | RUN; 168 | -------------------------------------------------------------------------------- /Chapter 03.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | data employees_scoring; 7 | set employees; 8 | rename duration = _T_; 9 | keep empno department gender techknowhow duration; 10 | if resigned = 0 then output; 11 | run; 12 | 13 | 14 | 15 | *** 3.5; 16 | 17 | 18 | 19 | data employees_expanded; 20 | set employees; 21 | do _T_ = 1 to duration; 22 | if _T_ NE duration then Event = 0; 23 | else Event = Resigned; 24 | output; 25 | end; 26 | run; 27 | 28 | 29 | 30 | 31 | 32 | *** 3.5.3; 33 | 34 | data employees_sales; 35 | set employees(where=(department="SALES_REP")); 36 | run; 37 | 38 | 39 | data employees_sales_expanded_qtr; 40 | merge employees_sales 41 | sales_targetratios; 42 | by empno; 43 | if first.empno then _T_ = 1; 44 | else _T_+1; 45 | Event=0; 46 | if last.empno then Event=(1-Status); 47 | run; 48 | 49 | data employees_sales_expanded_monthly; 50 | merge employees_sales 51 | sales_targetratios; 52 | by empno; 53 | format ObsMonth date9.; 54 | *** Loop over 3 months per quarter to expand the data; 55 | do i = 0 to 2; 56 | ObsMonth = intnx('MONTH',Quarter,i); 57 | _T_ = intck('MONTH',start,ObsMonth)+1; 58 | drop i; 59 | Event=0; 60 | if ObsMonth = intnx('MONTH',end,0,'BEGIN') then Event=(1-Status); 61 | if start <= ObsMonth <= intnx('MONTH',end,0,'BEGIN') then output; 62 | *** Exclude months before/after the start/end date; 63 | end; 64 | run; 65 | 66 | 67 | -------------------------------------------------------------------------------- /Chapter 04.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | *** 4.2; 5 | 6 | %let snapdate = '31DEC2016'D; 7 | %let start = '01JAN2004'D; 8 | 9 | data _null_; 10 | MonthCount= intck('MONTH',"&Start"d,&snapdate); 11 | call symput('MonthCount',MonthCount); 12 | run; 13 | 14 | data All_Months; 15 | format Month date9.; 16 | do i = 1 to &MonthCount; 17 | Month = intnx('MONTH',"&Start"d,i-1); 18 | drop i; 19 | output; 20 | end; 21 | run; 22 | 23 | 24 | *** 4.3; 25 | proc sort data = employees out=employees_sort; 26 | by empno; 27 | run; 28 | 29 | proc transpose data = employees_sort(keep = empno department start end) 30 | out = employees_tp(rename = (col1 = Date)); 31 | by empno; 32 | run; 33 | 34 | data employees_tp; 35 | set employees_tp; 36 | by empno; 37 | format start date9.; 38 | retain start; 39 | if first.empno then start = date; 40 | if date = . then date = &snapdate; 41 | run; 42 | proc sort data = employees_tp; 43 | by start; 44 | run; 45 | 46 | data employees_tp; 47 | set employees_tp; 48 | _ID_ = ceil(_n_/2); 49 | run; 50 | 51 | 52 | 53 | proc sgplot data=employees_tp; 54 | series x=date y=_ID_ / group=empno 55 | LINEATTRS = (THICKNESS = 1 56 | Pattern = solid 57 | Color = black); 58 | run; 59 | 60 | 61 | 62 | *** 4.4; 63 | proc sql; 64 | create table Emp_Count as 65 | select Month, 66 | count(distinct empno) as Emp_Count 67 | from All_Months as a 68 | left join employees as b on intnx('MONTH',b.end,0,'BEGIN') > a.Month 69 | and b.start <= a.Month 70 | group by Month; 71 | create table Leavers as 72 | select intnx('MONTH',end,0,'BEGIN') as end format = date9., 73 | count(distinct empno) as Leavers 74 | from employees 75 | where end ne . 76 | group by end; 77 | create table NewHire as 78 | select start, 79 | count(distinct empno) as NewHires 80 | from employees 81 | where start ne . 82 | group by start; 83 | create table AllCounts 84 | as select a.Month, 85 | a.Emp_Count, 86 | case when b.NewHires=. then 0 else b.NewHires end as NewHires, 87 | case when c.Leavers=. then 0 else c.Leavers end as Leavers 88 | from Emp_Count as a 89 | left join NewHire as b on a.Month = b.start 90 | left join Leavers as c on a.Month = c.end; 91 | quit; 92 | 93 | 94 | data AllCounts; 95 | set AllCounts; 96 | retain NumberTMP; 97 | NumberTMP2 = sum(NumberTMP,NewHires,-lag(Leavers)); 98 | NumberTMP = NumberTMP2; 99 | Employees = NumberTMP2 - NewHires - Leavers; 100 | drop NumberTMP NumberTMP2 Emp_Count; 101 | run; 102 | 103 | proc transpose data = AllCounts 104 | out = AllCounts_TP(rename = (_name_ = Type Col1 = Number)); 105 | by Month; 106 | run; 107 | 108 | data AllCounts_TP; 109 | set AllCounts_TP; 110 | label Type = "Type"; 111 | run; 112 | 113 | 114 | proc sgplot data=AllCounts_TP; 115 | format month yymmp7.; 116 | vbar month / group=type response=Number ; 117 | xaxis fitpolicy=thin; 118 | where month >= '01JAN2009'd; 119 | run; 120 | 121 | 122 | 123 | ***************** Black White Version of the Graph ***********; 124 | *** http://support.sas.com/kb/43/731.html; 125 | /* Define an attribute map to associate specific fill colors 126 | with data values */ 127 | /* The ID required variable contains the name of the attribute map */ 128 | /* The VALUE required variable contains the value of the GROUP variable, 129 | which in this case is FLAVOR */ 130 | /* The FILLCOLOR variable is used to change the color for the bars created by the VBAR 131 | statement. */ 132 | data attrmap; 133 | input id $4. @6 value $9. @16 fillcolor $8.; 134 | datalines; 135 | Type Leavers white 136 | Type Employees CXC0C0C0 137 | Type NewHires black 138 | ; 139 | run; 140 | 141 | proc sgplot data=AllCounts_TP dattrmap=attrmap; 142 | format month yymmp7.; 143 | vbar month / group=type response=Number attrid=Type outlineattrs=(color=black); 144 | xaxis fitpolicy=thin; 145 | where month >= '01JAN2009'd; 146 | run; 147 | 148 | 149 | 150 | 151 | 152 | 153 | *** 4.5; 154 | proc sql; 155 | create table KnowHowYearsEmpno as 156 | select month, 157 | empno, 158 | round(sum(intck('MONTH',b.start,a.month)),1) as Knowledge_Months 159 | from All_Months as a 160 | left join Employees(where =(department in ('TECH_SUPPORT', 'SALES_ENGINEER') 161 | and TechKnowHow = "YES" )) as b 162 | on intnx('MONTH',sum(b.end,(b.end=.)*&snapdate),0) > a.month 163 | and b.start <= a.month 164 | group by month, empno; 165 | quit; 166 | 167 | 168 | proc sgplot data= KnowHowYearsEmpno; 169 | format month yymmp7.; 170 | vbar month / response=Knowledge_Months group=EmpNo; 171 | xaxis fitpolicy=thin; 172 | where month > '01JAN2009'd; 173 | run; 174 | -------------------------------------------------------------------------------- /Chapter 05.sas: -------------------------------------------------------------------------------- 1 | *** 5.3; 2 | 3 | 4 | proc sgplot data=flights_911; 5 | format Passengers comma8.; 6 | series x=date y=passengers; 7 | run; 8 | 9 | 10 | *** 5.4; 11 | 12 | PROC EXPAND DATA=flights_911 OUT=AirlinePassengersSmooth; 13 | CONVERT passengers = pass_smooth_backw / TRANSFORMOUT = (MOVAVE 12); 14 | RUN; 15 | 16 | 17 | proc sgplot data=AirlinePassengersSmooth; 18 | format Passengers pass_smooth_backw comma8.; 19 | series x=date y=passengers; 20 | series x=date y=pass_smooth_backw; 21 | run; 22 | 23 | 24 | 25 | 26 | PROC EXPAND DATA=flights_911 OUT=AirlinePassengersSmooth; 27 | CONVERT passengers = pass_smooth_backw / TRANSFORMOUT = (MOVAVE 12); 28 | CONVERT Passengers = pass_smooth_center/ TRANSFORMOUT = (CMOVAVE 12); 29 | RUN; 30 | 31 | 32 | proc sgplot data=AirlinePassengersSmooth; 33 | format Passengers pass_smooth_backw comma8.; 34 | series x=date y=passengers; 35 | series x=date y=pass_smooth_backw; 36 | series x=date y=pass_smooth_center; 37 | refline '01SEP2001'd / axis = x; 38 | run; 39 | 40 | 41 | 42 | *** 5.3.4; 43 | 44 | PROC EXPAND DATA=flights_911 OUT=AirlinePassengersSmooth; 45 | CONVERT passengers = pass_smooth_backw / TRANSFORMOUT = (MOVAVE 12); 46 | CONVERT Passengers = pass_smooth_center/ TRANSFORMOUT = (CMOVAVE 47 | (0.0467 0.0833 0.833 0.0833 0.833 0.0833 0.833 0.0833 0.833 0.0833 0.833 0.0833 0.0467)); 48 | RUN; 49 | 50 | 51 | 52 | *** 5.3.5; 53 | 54 | PROC EXPAND DATA=flights_911 OUT=AirlinePassengersSmooth; 55 | CONVERT passengers = pass_smooth_backw / TRANSFORMOUT = (MOVAVE 12); 56 | CONVERT passengers = pass_smooth_backwTr / TRANSFORMOUT = (MOVAVE 12 trimleft 11); 57 | CONVERT Passengers = pass_smooth_centerWgt/ TRANSFORMOUT = (CMOVAVE 58 | (0.0467 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0467)); 59 | CONVERT Passengers = pass_smooth_centerWgtTr/ TRANSFORMOUT = (CMOVAVE 60 | (0.0467 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0467) 61 | TRIM 6); 62 | RUN; 63 | 64 | data AirlinePassengersSmooth; 65 | format time 8. date yymmp7. passengers 8. ; 66 | set AirlinePassengersSmooth; 67 | *where 0 <= time <= 12; 68 | where 158 <= time <= 169; 69 | drop Nflights; 70 | run; 71 | 72 | *** 5.4; 73 | 74 | Data Smooth_911_DST; 75 | set flights_911; 76 | Passengers_Smoothed = mean(Passengers, 77 | Lag(Passengers), 78 | Lag2(Passengers), 79 | Lag3(Passengers), 80 | Lag4(Passengers), 81 | Lag5(Passengers), 82 | Lag6(Passengers), 83 | Lag7(Passengers), 84 | Lag8(Passengers), 85 | Lag9(Passengers), 86 | Lag10(Passengers), 87 | Lag11(Passengers)); 88 | run; 89 | 90 | Data Smooth_911_DST; 91 | set flights_911; 92 | Passengers_Smoothed = (Passengers + 93 | Lag(Passengers) + 94 | Lag2(Passengers)+ 95 | Lag3(Passengers)+ 96 | Lag4(Passengers)+ 97 | Lag5(Passengers)+ 98 | Lag6(Passengers)+ 99 | Lag7(Passengers)+ 100 | Lag8(Passengers)+ 101 | Lag9(Passengers)+ 102 | Lag10(Passengers)+ 103 | Lag11(Passengers))/12; 104 | run; 105 | 106 | data Smooth_911_efficent; 107 | retain s; 108 | set flights_911; 109 | s = sum (s, Passengers, -lag12(Passengers)) ; 110 | Passengers_Smoothed = s / min(_N_,12); 111 | drop s; 112 | run; 113 | 114 | 115 | *** 5.4.5; 116 | 117 | proc FCMP outlib = sasuser.funcs.util; 118 | subroutine cmovave3(actual[*], movave[*]); 119 | outargs movave; 120 | do t = 1 to DIM(actual); 121 | movave[t] = (actual[t-1]+actual[t]+actual[t+1])/3; 122 | end; 123 | endsub; 124 | run; 125 | 126 | options cmplib=sasuser.funcs; 127 | 128 | 129 | proc timedata data=work.flights_911 130 | out =work.flights_911_out 131 | outarray=flights_911_array; 132 | id date interval=month accumulate=total format=yymmdd.; 133 | vars passengers; 134 | outarrays passengers_moveave; 135 | call cmovave3(passengers, passengers_moveave); 136 | run; 137 | 138 | 139 | -------------------------------------------------------------------------------- /Chapter 06.sas: -------------------------------------------------------------------------------- 1 | /** 2 | PROC EXPAND DATA=flights_911 OUT=AirlinePassengersSmooth; 3 | CONVERT Passengers = pass_smooth_backwTr/ TRANSFORMOUT = (MOVAVE 12 TRIMLEFT 11); 4 | RUN; 5 | 6 | 7 | **/ 8 | 9 | data Demo_xy_Data; 10 | do i = 1 to 500; 11 | x = 1 + uniform(20655) * 4; 12 | y = sin(x) + 0.2 * normal(121); 13 | output; 14 | end; 15 | run; 16 | 17 | /*** 18 | proc adaptivereg data=Demo_xy_Data plots=all details=bases; 19 | model y = x; 20 | run; 21 | ***/ 22 | %DetectBrkPoint(data=Demo_xy_Data,target=y,date=x,formatdate=NO,maxbasis=,plot=scatter,format=8.2); 23 | 24 | 25 | 26 | proc sgplot data=Demo_xy_Data_y_adpt noautolegend; 27 | series x=x y=pred_y / lineattrs=(color=crimson thickness = 7); 28 | scatter x=x y=y / markerattrs=(color=bigb); 29 | refline 4.28 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 30 | refline 2.13 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 31 | refline 1.21 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 32 | refline 2.64 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 33 | refline 3.85 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 34 | refline 1.08 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 35 | refline 3.59 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 36 | 37 | run; 38 | 39 | 40 | 41 | proc sgplot data=Demo_xy_Data_y_adpt noautolegend; 42 | series x=x y=pred_y / lineattrs=(color=crimson thickness = 7); 43 | scatter x=x y=y / markerattrs=(color=bigb); 44 | refline 1.79 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 45 | refline 4.14 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 46 | refline 3.34 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 47 | refline 4.75 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 48 | refline 2.51 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 49 | refline 1.33 / axis = x lineattrs=(color=grey thickness=3 pattern=2); 50 | run; 51 | 52 | 53 | *** 6.3; 54 | 55 | 56 | proc adaptivereg data=AirlinePassengersSmooth plots=all; 57 | ods select FitPlot; 58 | model pass_smooth_backwTr = date; 59 | run; 60 | 61 | 62 | 63 | proc adaptivereg data=AirlinePassengersSmooth plots=all; 64 | ods select BWDParams; 65 | model pass_smooth_backwTr = date; 66 | run; 67 | 68 | 69 | 70 | proc adaptivereg data=AirlinePassengersSmooth plots=all; 71 | ods select BWDParams; 72 | model pass_smooth_backwTr = date / maxbasis = 11; 73 | run; 74 | 75 | 76 | 77 | proc adaptivereg data=AirlinePassengersSmooth plots=all; 78 | ods select FitPlot; 79 | model pass_smooth_backwTr = date / maxbasis = 11; 80 | run; 81 | 82 | 83 | 84 | *** 6.4; 85 | 86 | 87 | proc adaptivereg data=AirlinePassengersSmooth plots=all; 88 | model pass_smooth_backwTr = date / maxbasis = 11; 89 | ods output BWDParams=KnotPoints; 90 | output out=flights_adpt predicted=pred_adpt; 91 | run; 92 | 93 | filename reflines 'c:/tmp/reflines.sas'; 94 | data _NULL_; 95 | set KnotPoints; 96 | where name not in ("Basis0", "Basis1"); 97 | file reflines; 98 | put @04 "refline " knot " / axis = x;"; 99 | run; 100 | 101 | 102 | proc sgplot data=flights_adpt; 103 | series x=date y=passengers; 104 | series x=date y=pass_smooth_backwTr/lineattrs=(pattern=4); 105 | series x=date y=pred_adpt/lineattrs=(pattern=3); 106 | %include reflines; 107 | run; 108 | 109 | 110 | 111 | proc sql; 112 | select knot format = date9. 113 | from KnotPoints 114 | where name not in ("Basis0", "Basis1") 115 | order by knot; 116 | quit; 117 | 118 | 119 | 120 | 121 | proc sgplot data=flights_adpt; 122 | series x=date y=passengers; 123 | series x=date y=pass_smooth_backwTr/lineattrs=(pattern=4); 124 | series x=date y=pred_adpt/lineattrs=(pattern=3); 125 | where 1999 <= year(date) <= 2003; 126 | %include reflines; 127 | run; 128 | 129 | 130 | 131 | proc adaptivereg data=AirlinePassengersSmooth plots=all ; 132 | model pass_smooth_backwTr = date/ maxbasis=11; 133 | ods output BWDParams=KnotPoints; 134 | output out=flights_adpt predicted=pred_adpt; 135 | run; 136 | 137 | 138 | *** 6.5; 139 | 140 | 141 | proc sgplot data=patients_recruitment; 142 | series x=randdate y=patientcnt; 143 | run; 144 | 145 | 146 | *** 6.5.2; 147 | 148 | 149 | proc adaptivereg data=patients_recruitment plots=all; 150 | format randdate date9.; 151 | model PatientCnt = randdate; 152 | ods output BWDParams=KnotPoints; 153 | output out=recruit_adpt predicted=pred_adpt; 154 | where '01JUN2005'd < randdate <= '01APR2011'd ; 155 | run; 156 | 157 | 158 | 159 | proc sql; 160 | select knot format = date9. 161 | from KnotPoints 162 | where name not in ("Basis0", "Basis1") 163 | order by knot; 164 | quit; 165 | 166 | 167 | *** Change the PATH C:\TMP to an individual path on your file system; 168 | filename reflines 'c:/tmp/reflines_recr.sas'; 169 | data _NULL_; 170 | set KnotPoints; 171 | where upcase(variable) eq upcase('randdate'); 172 | format knot 8.; 173 | file reflines; 174 | put @04 "refline " knot " / axis = x;"; 175 | run; 176 | 177 | 178 | 179 | proc sgplot data=recruit_adpt; 180 | series x=randdate y=PatientCnt; 181 | series x=randdate y=pred_adpt; 182 | %include reflines; 183 | run; 184 | 185 | 186 | 187 | 188 | *** 6.5.3; 189 | 190 | proc sort data=patients out=patients_sort; 191 | by Randdate; 192 | run; 193 | 194 | 195 | proc sgplot data=patients_sort; 196 | series x=randdate y=ldl; 197 | xaxis label="Randomization Date"; 198 | run; 199 | 200 | 201 | 202 | 203 | 204 | proc adaptivereg data=patients_sort plots=all; 205 | model LDL = randdate; 206 | ods output BWDParams=KnotPoints; 207 | output out=Baseline_adpt predicted=pred_adpt; 208 | run; 209 | 210 | 211 | proc sql; 212 | select knot format = date9. 213 | from KnotPoints 214 | where name not in ("Basis0", "Basis1") 215 | order by knot; 216 | quit; 217 | 218 | *** Change the PATH C:\TMP to an individual path on your file system; 219 | filename reflines 'c:/tmp/reflines_recr.sas'; 220 | data _NULL_; 221 | set KnotPoints; 222 | where upcase(variable) eq upcase('randdate'); 223 | format knot 8.; 224 | file reflines; 225 | put @04 "refline " knot " / axis = x;"; 226 | run; 227 | 228 | 229 | 230 | proc sgplot data=Baseline_adpt; 231 | series x=randdate y=LDL; 232 | series x=randdate y=pred_adpt; 233 | %include reflines; 234 | run; 235 | 236 | 237 | -------------------------------------------------------------------------------- /Chapter 07.sas: -------------------------------------------------------------------------------- 1 | 2 | *** 7.2; 3 | data timeplot; 4 | call streaminit(20656); 5 | do Year = 1970 to 2016; 6 | Value = (year - 1960)*2+rand('normal',0,6); 7 | Value_Shift = value+(year>=1990)*20; 8 | Value_Outlier = value+(year=1992) *40; 9 | output; 10 | end; 11 | run; 12 | 13 | 14 | proc sgplot data=timeplot; 15 | scatter x=year y=value; 16 | yaxis min=0 max=140; 17 | run; 18 | 19 | 20 | 21 | proc sgplot data=timeplot; 22 | scatter x=year y=value_shift; 23 | refline 1990 /axis=x; 24 | yaxis min=0 max=140; 25 | run; 26 | 27 | 28 | 29 | proc sgplot data=timeplot; 30 | scatter x=year y=value_outlier; 31 | yaxis min=0 max=140; 32 | refline 1992 /axis=x; 33 | run; 34 | 35 | 36 | 37 | *** 7.3; 38 | 39 | 40 | 41 | proc sgplot data=flights_911; 42 | format Passengers comma8.; 43 | series x=date y=passengers; 44 | run; 45 | 46 | 47 | 48 | proc x13 data=flights_911 date=date; 49 | var passengers; 50 | arima model=( (0,1,1)(0,1,1) ); 51 | outlier; 52 | ods select RegParameterEstimates; 53 | run; 54 | 55 | 56 | 57 | 58 | proc x13 data=flights_911 date=date; 59 | var passengers; 60 | arima model=( (0,1,1)(0,1,1) ); 61 | outlier; 62 | ods output RegParameterEstimates=RegParameterEstimates; 63 | ods select RegParameterEstimates; 64 | run ; 65 | 66 | 67 | 68 | filename reflines 'c:/tmp/reflines_airline.sas'; 69 | data _NULL_; 70 | set RegParameterEstimates; 71 | file reflines; 72 | Date=cats("'01",compress(substr(regvar,3,length(regvar))),"'d"); 73 | put @04 "refline " Date " / axis = x label = '" regvar "';"; 74 | run; 75 | 76 | 77 | proc sgplot data=flights_911; 78 | series x=date y=passengers; 79 | yaxis label="Passengers"; 80 | xaxis label="Date"; 81 | %include reflines; 82 | run; 83 | 84 | 85 | 86 | proc print data=RegParameterEstimates noobs; 87 | format estimate nlnum16.1; 88 | var regvar estimate; 89 | run; 90 | 91 | 92 | 93 | proc sgplot data=flights_911; 94 | series x=date y=passengers; 95 | yaxis label='Passengers'; 96 | xaxis label="Date"; 97 | refline '01SEP2001'd / axis = x label="Level Shift at 9/11"; 98 | refline '01NOV2001'd / axis = x label="Level Shift +"; 99 | refline '01DEC2002'd / axis = x label="Outlier +"; 100 | refline '01DEC2003'd / axis = x Label="Level Shift -"; 101 | run; 102 | 103 | 104 | *** 7.4; 105 | 106 | 107 | 108 | proc x11 data=flights_911; 109 | monthly date=date additive 110 | fullweight=3.0 zeroweight=3.5; 111 | var passengers; 112 | ods select d9; 113 | table d9; 114 | run; 115 | 116 | 117 | 118 | *** 7.4.3; 119 | 120 | proc hpfdiagnose data=flights_911 print=short outoutlier=outliers; 121 | id date interval=month accumulate=total; 122 | forecast passengers; 123 | arimax outlier=(detect=maybe); 124 | ods select arimaspec; 125 | run; 126 | 127 | 128 | 129 | *** 7.4.3; 130 | 131 | proc hpfdiagnose data=flights_911 print=all outoutlier=outliers; 132 | id date interval=month accumulate=total; 133 | forecast passengers; 134 | arimax outlier=(detect=maybe); 135 | ods select OutlierInfo; 136 | run; 137 | 138 | 139 | -------------------------------------------------------------------------------- /Chapter 08.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | proc sql; 6 | create table flights_month_aggr 7 | as select month(date) as start format = 8., 8 | round(avg(passengers)/100000) as label format = 8., 9 | 'i' as type, 10 | 'FL_Mon' as fmtname 11 | from flights_911 12 | where 1990 <= year(date) <= 2000 13 | group by start; 14 | quit; 15 | 16 | 17 | proc format cntlin=flights_month_aggr; 18 | run; 19 | 20 | data flights_simul; 21 | call streaminit(123456); 22 | format Date yymmp7. Passengers 8.; 23 | do Year = 1981 to 2000; 24 | do month = 1 to 12; 25 | date = mdy(month,1,year); 26 | passengers = (input(month, fl_mon.)-400)*40; 27 | passengers = Passengers + (year-1981+1)*1000; 28 | passengers = passengers + rand('uniform')*1000; 29 | if year in (1986,1987) then passengers = passengers * 1.2; 30 | passengers = Passengers + (year in (1992)) * (-month*300); 31 | if date = '01APR1997'd then passengers = passengers * 1.25; 32 | if date = '01SEP1998'd then passengers = passengers * 0.8; 33 | if date = '01APR1990'd then passengers = passengers * 1.2; 34 | output; 35 | end; 36 | end; 37 | run; 38 | 39 | 40 | proc sgplot data=flights_simul; 41 | series x=date y=passengers; 42 | run; 43 | 44 | 45 | 46 | *** 8.3 AdaptiveReg; 47 | 48 | 49 | 50 | proc adaptivereg data=flights_simul plots=all details=bases ; 51 | format date date9.; 52 | model passengers = date; 53 | ods output BWDParams=KnotPoints; 54 | output out=flights_adpt predicted=pred_adpt; 55 | run; 56 | 57 | data KnotPoints; 58 | set KnotPoints; 59 | format knot date9.; 60 | run; 61 | 62 | proc print data=KnotPoints;run; 63 | 64 | proc sql; 65 | select Knot "Date" 66 | from work.knotpoints 67 | where name not in ("Basis0", "Basis1") 68 | order by knot; 69 | quit; 70 | 71 | filename reflines 'c:/tmp/reflines.sas'; 72 | data _NULL_; 73 | set KnotPoints; 74 | where upcase(variable) ne 'INTERCEPT'; 75 | format knot 8.; 76 | file reflines; 77 | put @04 "refline " knot " / axis = x;"; 78 | run; 79 | 80 | 81 | proc sgplot data=flights_adpt; 82 | series x=date y=passengers; 83 | series x=date y=pred_adpt; 84 | %include reflines; 85 | run; 86 | 87 | 88 | 89 | ** smooth; 90 | proc expand data=flights_simul OUT=flights_simul_smooth METHOD=NONE; 91 | CONVERT passengers = Passengers_Smooth / TRANSFORM = (MOVAVE 12 trimleft 11); 92 | run; 93 | 94 | 95 | proc sgplot data=flights_simul_smooth; 96 | series x=date y=passengers; 97 | series x=date y=Passengers_Smooth; 98 | run; 99 | 100 | 101 | 102 | 103 | 104 | proc adaptivereg data=flights_simul_smooth plots=all details=bases ; 105 | format date date9.; 106 | model passengers_smooth = date; * / maxbasis=9; 107 | ods output BWDParams=KnotPoints; 108 | output out=flights_adpt predicted=pred_adpt; 109 | *where '01JAN1982'd <= date ; 110 | run; 111 | 112 | 113 | data KnotPoints; 114 | set KnotPoints; 115 | format knot date9.; 116 | run; 117 | 118 | proc print data=KnotPoints;run; 119 | 120 | proc sql; 121 | select Knot "Date" 122 | from work.knotpoints 123 | where name not in ("Basis0", "Basis1") 124 | order by knot; 125 | quit; 126 | 127 | 128 | filename reflines 'c:/tmp/reflines.sas'; 129 | data _NULL_; 130 | set KnotPoints; 131 | where upcase(variable) ne 'INTERCEPT'; 132 | format knot 8.; 133 | file reflines; 134 | put @04 "refline " knot " / axis = x;"; 135 | run; 136 | 137 | 138 | 139 | proc sgplot data=flights_adpt; 140 | series x=date y=passengers_smooth; 141 | series x=date y=pred_adpt; 142 | %include reflines; 143 | run; 144 | 145 | 146 | 147 | 148 | *** 8.4 Outliers; 149 | proc x13 data=flights_simul date=date ; 150 | var passengers; 151 | arima model=( (1,1,0)(2,0,0) ); 152 | outlier alpha=0.1; 153 | ods output RegParameterEstimates=RegParameterEstimates; 154 | run ; 155 | 156 | 157 | 158 | 159 | 160 | filename reflines 'c:/tmp/reflines.sas'; 161 | data _NULL_; 162 | set RegParameterEstimates; 163 | file reflines; 164 | Date=cats("'01",compress(substr(regvar,3,length(regvar))),"'d"); 165 | put @04 "refline " Date " / axis = x label = '" regvar "';"; 166 | run; 167 | 168 | 169 | 170 | proc sgplot data=flights_simul; 171 | series x=date y=passengers; 172 | yaxis label="Passengers"; 173 | xaxis label="Date"; 174 | %include reflines; 175 | /* 176 | refline '01JAN1986'd / axis = x label="Start +20%"; 177 | refline '01JAN1988'd / axis = x label="End +20%"; 178 | refline '01APR1990'd / axis = x label="Outlier +20%"; 179 | refline '01JAN1993'd / axis = x Label="End -300/Month"; 180 | refline '01APR1997'd / axis = x label="Outlier +25%"; 181 | refline '01SEP1998'd / axis = x label="Outlier -20%"; 182 | */ 183 | run; 184 | 185 | -------------------------------------------------------------------------------- /Chapter 09.sas: -------------------------------------------------------------------------------- 1 | 2 | proc sgplot data=sales_eur; 3 | series x=date y=Sales_EUR; 4 | run; 5 | 6 | 7 | 8 | 9 | PROC EXPAND data=sales_eur OUT=sales_smooth METHOD=NONE; 10 | CONVERT Sales_EUR = Sales_Smooth / TRANSFORM = (MOVAVE 12 trimleft 11); 11 | RUN; 12 | 13 | 14 | proc sgplot data=sales_smooth; 15 | series x=date y=Sales_EUR; 16 | series x=date y=Sales_Smooth; 17 | run; 18 | 19 | 20 | 21 | proc adaptivereg data=sales_smooth; 22 | format date date9.; 23 | model Sales_Smooth = date; 24 | ods output BWDParams=KnotPoints; 25 | output out=Sales_adpt predicted=pred_adpt; 26 | where Year >= 1998 ; 27 | run; 28 | filename reflines 'c:/tmp/reflines.sas'; 29 | data _NULL_; 30 | set KnotPoints; 31 | where upcase(variable) ne 'INTERCEPT'; 32 | format knot 8.; 33 | file reflines; 34 | put @04 "refline " knot " / axis = x;"; 35 | run; 36 | proc sgplot data=Sales_adpt; 37 | series x=date y=Sales_Smooth; 38 | series x=date y=pred_adpt; 39 | %include reflines; 40 | run; 41 | 42 | 43 | 44 | 45 | proc shewhart data=work.sales_eur ; 46 | xschart sales_eur*year / outhistory=sales_mean;* lsl=1500; 47 | where 1998 <= year <= 2014; 48 | run; 49 | 50 | 51 | 52 | 53 | proc adaptivereg data=sales_mean details=(fwdsummary bwdsummary); 54 | format date date9.; 55 | model sales_eurx = year; 56 | ods output BWDParams=KnotPoints; 57 | output out=Sales_adpt predicted=pred_adpt; 58 | run; 59 | filename reflines 'c:/tmp/reflines.sas'; 60 | data _NULL_; 61 | set KnotPoints; 62 | where upcase(variable) ne 'INTERCEPT'; 63 | format knot 8.; 64 | file reflines; 65 | put @04 "refline " knot " / axis = x;"; 66 | run; 67 | 68 | 69 | proc sgplot data=Sales_adpt; 70 | series x=year y=sales_eurx; 71 | series x=year y=pred_adpt; 72 | %include reflines; 73 | run; 74 | 75 | 76 | 77 | proc adaptivereg data=sales_mean; 78 | format date date9.; 79 | model sales_eurs = year; 80 | ods output BWDParams=KnotPoints; 81 | output out=Sales_adpt predicted=pred_adpt; 82 | run; 83 | filename reflines 'c:/tmp/reflines.sas'; 84 | data _NULL_; 85 | set KnotPoints; 86 | where upcase(variable) ne 'INTERCEPT'; 87 | format knot 8.; 88 | file reflines; 89 | put @04 "refline " knot " / axis = x;"; 90 | run; 91 | 92 | 93 | proc sgplot data=Sales_adpt; 94 | series x=year y=sales_eurs; 95 | series x=year y=pred_adpt; 96 | %include reflines; 97 | run; 98 | 99 | 100 | 101 | *** 9.4; 102 | 103 | data flights_911_xt; 104 | set flights_911; 105 | Month = month(date); 106 | Year = year(date); 107 | Passengers_Dif = dif12(passengers); 108 | run; 109 | 110 | data Visitors_MarchApril; 111 | set flights_911_xt; 112 | Visitors = (Passengers_Dif + 5000000)/100; 113 | format Easter PalmSunday HolidayStart date9.; 114 | if year = 1993 then Easter = '11APR1993'd; 115 | else if year = 1994 then Easter = '03APR1994'd; 116 | else if year = 1995 then Easter = '16APR1995'd; 117 | else if year = 1996 then Easter = '07APR1996'd; 118 | else if year = 1997 then Easter = '30MAR1997'd; 119 | else if year = 1998 then Easter = '12APR1998'd; 120 | else if year = 1999 then Easter = '04APR1999'd; 121 | else if year = 2000 then Easter = '23APR2000'd; 122 | if Month=3 then MonthName = '3-March'; 123 | else MonthName = '4-April'; 124 | PalmSunday = Easter - 7; 125 | HolidayStart = Easter - 9; 126 | HolidayStartMonth = month(PalmSunday); 127 | If HolidayStartMonth = 3 then UpperBand = 12; else Upperband = 0; 128 | LowerBand=0; 129 | where month in (3,4) and 1992 < year(date) < 2001; 130 | run; 131 | 132 | 133 | 134 | 135 | proc sgplot data=Visitors_MarchApril; 136 | series x=year y=Visitors / group=MonthName ; 137 | step x=year y=HolidayStartMonth / y2axis justify=center lineattrs=(color=green ); 138 | band x=year upper=upperband lower=0 / transparency=0.8; 139 | yaxis min=0; 140 | y2axis values=(0 to 12 by 1) integer; 141 | run; 142 | 143 | 144 | -------------------------------------------------------------------------------- /Chapter 10.sas: -------------------------------------------------------------------------------- 1 | 2 | proc format; 3 | value mid 1 = ' LONG Pure' 4 | 4 = 'SHORT ShiftLevel' 5 | 5 = 'LONG XT' 6 | 6 = 'LONG DownTrend' 7 | 7 = ' SHORT XT'; 8 | run; 9 | 10 | 11 | 12 | *** 10.4; 13 | 14 | proc sort data=statfc out=statfc_sort; 15 | by id target_month create_month; 16 | run; 17 | 18 | proc sort data=manfc out=manfc_sort; 19 | by id target_month create_month; 20 | run; 21 | 22 | data fc_all 23 | fc 24 | fc_statonly 25 | fc_manonly 26 | fc_ActualQu_mismatch 27 | ; 28 | merge statfc_sort (in=in_stat rename=(Actual=ActualStat)) 29 | manfc_sort (in=In_man rename=(Actual=ActualMan)); 30 | by id target_month create_month; 31 | 32 | format model mid.; 33 | Stat_IND = in_stat; 34 | Man_IND = in_man; 35 | StatMan_IND = cats(stat_ind,man_ind); 36 | 37 | rename ActualStat = Actual; 38 | rename ManFC = JudgmFC; 39 | drop ActualMan; 40 | output fc_all; 41 | 42 | if in_stat and in_man then do; 43 | if ActualStat =ActualMan then output fc; 44 | else output fc_ActualQu_mismatch; 45 | end; 46 | else if in_stat then output fc_statonly; 47 | else output fc_manonly; 48 | 49 | run; 50 | 51 | 52 | proc sql; 53 | create table material_view 54 | as select b.id, 55 | b.Product_Group, 56 | b.Price_Index , 57 | b.Launch_Date format = yymmddp12. 58 | from material as b; 59 | quit; 60 | 61 | proc sql; 62 | create table fc_mart 63 | as select a.*, 64 | b.Product_Group, 65 | b.Price_Index , 66 | b.Launch_Date , 67 | month(b.Launch_Date) as Launch_Month, 68 | year(b.Launch_Date) as Launch_Year 69 | from fc as a 70 | right join material as b 71 | on a.id = b.id 72 | where a.actual > 0 and a.actual ne . 73 | order by id, target_month, create_month; 74 | quit; 75 | 76 | 77 | 78 | data fc_mart; 79 | format FC_ID 8.; 80 | set fc_mart; 81 | FC_ID = _N_; 82 | 83 | if price_index in (0,999) then Price_Index = .; 84 | 85 | /*** FC-derived variables ***/ 86 | Create_CalMonth = month(create_month); 87 | Create_Year = year(create_month); 88 | Target_CalMonth = month(target_month); 89 | Target_Year = year(target_month); 90 | /*** Lead Times ***/ 91 | Lead_Time = intck('MONTH',create_month,target_month); 92 | Product_Age = intck('MONTH',launch_date,target_month); 93 | if Product_Age > 120 then Product_Age=120; 94 | 95 | /*** MAPE-Block ***/ 96 | format APE_Stat APE_Judgm APE_Stat_Shift APE_Judgm_shift 8.1; 97 | APE_Stat = abs(statfc - actual)/actual * 100; 98 | APE_Judgm= abs(JudgmFC - actual)/actual * 100; 99 | APE_stat_shift = min(ape_stat,300); 100 | APE_Judgm_shift = min(ape_Judgm,300); 101 | APE_STAT_LOG = log(ape_stat); 102 | APE_Judgm_LOG = log(ape_judgm); 103 | if Actual > 50 and StatFC not in (0,.) and JudgmFC not in (0,.); 104 | 105 | label Price_Index = "Price_Index"; 106 | 107 | run; 108 | 109 | 110 | /*** Launch Year Relativ ***/ 111 | /*** 112 | Create_Year_Rel = Create_Year - 2009; 113 | TimeID_Year_Rel = TimeID_Year - 2009; 114 | Laun_Year_Rel = Laun_Year - 1980; 115 | ***/ 116 | 117 | 118 | 119 | *** 10.5 Univariate Ergebnissse; 120 | 121 | proc means data=fc_mart mean std n min p10 q1 median q3 p90 p95 max maxdec=1; 122 | var APE_Stat; 123 | run; 124 | 125 | 126 | 127 | 128 | PROC SGPLOT DATA=fc_mart; 129 | histogram APE_Stat_shift; 130 | refline 86.5 / axis=x label="Mean"; 131 | refline 40.6 / axis=x label="Median"; 132 | RUN; 133 | 134 | 135 | 136 | 137 | PROC SGPLOT DATA=fc_mart; 138 | histogram APE_Stat_LOG; 139 | RUN; 140 | 141 | 142 | 143 | 144 | PROC SGPLOT DATA = fc_mart; 145 | VBOX ape_stat / CATEGORY=product_group NOOUTLIERS; 146 | yaxis max=300; 147 | RUN; 148 | 149 | 150 | 151 | 152 | PROC SGPLOT DATA = fc_mart; 153 | VBOX ape_stat / CATEGORY=Launch_Month NOOUTLIERS; 154 | yaxis max=300; 155 | RUN; 156 | 157 | 158 | 159 | 160 | 161 | PROC SGPLOT DATA = fc_mart; 162 | VBOX ape_stat / CATEGORY=Lead_time NOOUTLIERS; 163 | yaxis max=300; 164 | RUN; 165 | 166 | 167 | 168 | 169 | proc sgplot DATA = fc_mart; ; 170 | vbar lead_time; 171 | run; 172 | 173 | 174 | 175 | 176 | PROC SGPLOT DATA = fc_mart; 177 | VBOX ape_stat / CATEGORY=target_calmonth NOOUTLIERS; 178 | yaxis max=300 ; 179 | RUN; 180 | 181 | 182 | 183 | 184 | 185 | 186 | PROC SGPLOT DATA = fc_mart; 187 | VBOX ape_stat / CATEGORY=model NOOUTLIERS; 188 | yaxis max=300 ; 189 | RUN; 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | proc sgpanel data=fc_mart; 200 | panelby model / novarname; 201 | vbox ape_stat_shift / category=Target_year nooutliers; 202 | run; 203 | 204 | 205 | 206 | PROC MEANS DATA=fc_mart NWAY NOPRINT; 207 | VAR ape_stat; 208 | CLASS model Target_year; 209 | OUTPUT OUT=ape_means mean= median= /autoname; 210 | RUN; 211 | 212 | 213 | PROC SGPLOT DATA=ape_means; 214 | SERIES X=Target_year Y=ape_stat_median / group=model; 215 | YAXIS LABEL ="APE_STAT" min=0 max=100; 216 | RUN; 217 | 218 | 219 | 220 | proc format; 221 | value mid_tmp 1 = 'LONG' 222 | 4 = 'SHORT' 223 | 5 = 'LONG' 224 | 6 = 'LONG' 225 | 7 = 'SHORT'; 226 | run; 227 | 228 | PROC MEANS DATA=fc_mart NWAY NOPRINT; 229 | format model mid_tmp.; 230 | VAR ape_stat; 231 | CLASS model Target_year; 232 | OUTPUT OUT=ape_means_2grp mean= median= /autoname; 233 | RUN; 234 | 235 | 236 | PROC SGPLOT DATA=ape_means_2grp; 237 | SERIES X=Target_year Y=ape_stat_median / group=model; 238 | YAXIS LABEL ="APE_STAT" min=0 max=100; 239 | RUN; 240 | 241 | 242 | 243 | 244 | 245 | PROC MEANS DATA=fc_mart NWAY NOPRINT; 246 | VAR ape_stat; 247 | CLASS product_age; 248 | OUTPUT OUT=quartile_age MEDIAN=median Q1=q1 Q3=q3; 249 | RUN; 250 | 251 | PROC SGPLOT DATA=quartile_age noautolegend; 252 | band lower=q1 upper=q3 X=product_age ; 253 | SERIES X=product_age Y=median; 254 | YAXIS LABEL ="APE_STAT"; 255 | RUN; 256 | 257 | 258 | 259 | 260 | PROC MEANS DATA=fc_mart NWAY NOPRINT; 261 | VAR ape_stat; 262 | CLASS price_index; 263 | OUTPUT OUT=quartile_Price MEDIAN=median Q1=q1 Q3=q3; 264 | RUN; 265 | 266 | PROC SGPLOT DATA=quartile_Price noautolegend; 267 | band lower=q1 upper=q3 X=price_index ; 268 | SERIES X=price_index Y=median; 269 | YAXIS LABEL ="APE_STAT"; 270 | where price_index < 500; 271 | RUN; 272 | 273 | 274 | 275 | 276 | -------------------------------------------------------------------------------- /Chapter 11.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | *** 11.4; 4 | data fc_mart; 5 | set fc_mart; 6 | target_year_shift = target_year - 2009; 7 | run; 8 | 9 | 10 | PROC GLMSELECT DATA=fc_mart; 11 | CLASS product_group launch_month model target_calmonth / PARAM=effect show; 12 | MODEL ape_stat_shift = 13 | product_group|price_index|launch_month|product_age| 14 | model|lead_time|target_calmonth|target_year_shift @1 15 | /DETAILS=steps 16 | SELECTION=stepwise (SELECT=adjrsq) 17 | ORDERSELECT 18 | SHOWPVALUES; 19 | RUN; 20 | 21 | 22 | 23 | PROC GLMSELECT DATA=fc_mart; 24 | CLASS product_group launch_month model target_calmonth / PARAM=effect ; 25 | MODEL ape_stat_log = 26 | product_group|price_index|launch_month|product_age| 27 | model|lead_time|target_calmonth|target_year_shift @1 28 | /DETAILS=steps 29 | SELECTION=stepwise (SELECT=adjrsq) 30 | ORDERSELECT 31 | SHOWPVALUES; 32 | ods select SelectionSummary; 33 | RUN; 34 | 35 | 36 | 37 | ** 11.5; 38 | 39 | DATA NewArticle; 40 | ID = 60522123; 41 | product_group = 10; 42 | launch_month = 7; 43 | target_year_shift = 2016-2009; 44 | target_calmonth = 5; 45 | lead_time = 4; 46 | model = 7; ** = 'SHORT XT'; 47 | product_age = 10; 48 | price_index = 25; 49 | OUTPUT; 50 | RUN; 51 | 52 | 53 | DATA fc_mart_score; 54 | SET fc_mart 55 | NewArticle; 56 | RUN; 57 | 58 | 59 | 60 | PROC GLMSELECT DATA=fc_mart_score; 61 | CLASS product_group launch_month model target_calmonth / PARAM=effect ; 62 | MODEL ape_stat_shift = 63 | product_group|price_index|launch_month|product_age| 64 | model|lead_time|target_calmonth|target_year_shift @1 65 | /DETAILS=steps 66 | SELECTION=stepwise (SELECT=adjrsq) 67 | ORDERSELECT 68 | SHOWPVALUES; 69 | score data=NewArticle out=NewArticleScored predicted; 70 | RUN; 71 | -------------------------------------------------------------------------------- /Chapter 12.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | proc format;; 4 | value mid_cmpr 5 | 1 = 'LONG_Pure' 6 | 4 = 'SHORT_ShiftLevel' 7 | 5 = 'LONG_XT' 8 | 6 = 'LONG_DownTrend' 9 | 7 = 'SHORT_XT'; 10 | run; 11 | 12 | PROC GLMSELECT DATA=fc_mart; 13 | format model mid_cmpr.; 14 | CLASS launch_month model / PARAM=effect ; 15 | MODEL ape_stat_shift = Product_Age Model Launch_Month; 16 | ODS OUTPUT ParameterEstimates = ParameterEstimates1 17 | ClassLevelInfo = ClassLevelInfo1; 18 | run; 19 | 20 | 21 | %CALC_REFERENCE_CATEGORY( ParmEst = ParameterEstimates1, 22 | ClassLevels = ClassLevelInfo1); 23 | 24 | 25 | 26 | *** 12.4 Imputation; 27 | 28 | DATA fc_mart_impute; 29 | SET fc_mart; 30 | IF price_index in (0,999) THEN price_index=.; 31 | RUN; 32 | 33 | proc means data=fc_mart_impute nmiss; 34 | var Price_Index; 35 | run; 36 | 37 | PROC GLMSELECT data=FC_MART_IMPUTE; 38 | CLASS product_group; 39 | MODEL price_index = launch_year product_group; 40 | OUTPUT OUT = FC_MART_IMPUTE P=price_index_imputed; 41 | RUN; 42 | 43 | PROC SQL noprint; 44 | SELECT median(price_index) 45 | INTO :price_index_median 46 | FROM fc_mart_impute; 47 | QUIT; 48 | 49 | DATA FC_MART_IMPUTE; 50 | SET FC_MART_IMPUTE; 51 | if price_index = . then do; *** only for missing values of PRICE_INDEX; 52 | if price_index_imputed ne . then price_index = price_index_imputed; 53 | /** only if a valid value exists for PRICE_INDEX_IMPUTE **/ 54 | else price_index = &price_index_median; 55 | /** otherwise insert the median as fallback value **/ 56 | end; 57 | RUN; 58 | 59 | PROC MEANS DATA=FC_MART_IMPUTE n nmiss mean; 60 | VAR price_index; 61 | RUN; 62 | 63 | 64 | *** 12.5; 65 | 66 | PROC GLMSELECT DATA=fc_mart; 67 | CLASS product_group launch_month model target_calmonth / PARAM=effect ; 68 | MODEL ape_stat_shift = 69 | product_group|price_index|launch_month|product_age| 70 | model|lead_time|target_calmonth|target_year @1 71 | /DETAILS=steps 72 | SELECTION=stepwise (steps=1 ) ; 73 | OUTPUT OUT=glm_filter_modelname r=resid p=predict; 74 | RUN; 75 | -------------------------------------------------------------------------------- /Chapter 13.sas: -------------------------------------------------------------------------------- 1 | 2 | *** 11.4; 3 | data fc_mart; 4 | set fc_mart; 5 | target_year_shift = target_year - 2009; 6 | run; 7 | 8 | 9 | PROC SURVEYSELECT DATA=fc_mart 10 | OUT=fc_mart_smp10000 11 | METHOD=srs 12 | SAMPSIZE=10000 13 | SEED=19416 ; 14 | RUN; 15 | 16 | 17 | ** 14.2.3 Robustheit; 18 | title ape_stat_shift; 19 | 20 | 21 | proc means data=fc_mart_smp10000 mean median maxdec=2; 22 | var APE_Stat APE_Stat_Shift; 23 | run; 24 | 25 | 26 | 27 | PROC QUANTSELECT DATA=fc_mart_smp10000; 28 | CLASS product_group model / PARAM=effect ; 29 | MODEL ape_stat_shift = product_group|product_age|model|target_year_shift @1 30 | /QUANTILE = (0.5) 31 | DETAILS=summary 32 | SELECTION=none; 33 | ods select parameterestimates; 34 | RUN; 35 | 36 | 37 | *title ape_stat; 38 | 39 | 40 | PROC QUANTSELECT DATA=fc_mart_smp10000; 41 | CLASS product_group model / PARAM=effect ; 42 | MODEL ape_stat = product_group|product_age| model|target_year_shift @1 43 | /QUANTILE = (0.5) 44 | DETAILS=summary 45 | SELECTION=none; 46 | ods select parameterestimates; 47 | RUN; 48 | title; 49 | 50 | 51 | 52 | *** 14.2.4 -- 1st quartile; 53 | 54 | 55 | proc means data=fc_mart_smp10000 q1; 56 | class model; 57 | var APE_Stat; 58 | run; 59 | PROC QUANTSELECT DATA=fc_mart_smp10000 ; 60 | CLASS Model /PARAM =effect; 61 | MODEL ape_stat = Model / QUANTILE =(0.25); 62 | ods select parameterestimates; 63 | RUN; 64 | 65 | 66 | 67 | *** 14.3; 68 | 69 | 70 | PROC QUANTSELECT DATA=fc_mart_smp10000; 71 | CLASS product_group launch_month model target_calmonth / PARAM=effect ; 72 | MODEL ape_stat = 73 | product_group|price_index|launch_month|product_age| 74 | model|lead_time|target_calmonth|target_year_shift @1 75 | /QUANTILE = (0.25) 76 | DETAILS=summary 77 | SELECTION=stepwise; 78 | ods select SelectionSummary parameterestimates; 79 | RUN; 80 | 81 | 82 | 83 | 84 | PROC QUANTSELECT DATA=fc_mart_smp10000; 85 | CLASS product_group launch_month model target_calmonth / PARAM=effect ; 86 | MODEL ape_stat = 87 | product_group|price_index|launch_month|product_age| 88 | model|lead_time|target_calmonth|target_year_shift @1 89 | /QUANTILE = (0.5) 90 | DETAILS=summary 91 | SELECTION=stepwise; 92 | ods select SelectionSummary parameterestimates; 93 | RUN; 94 | 95 | 96 | 97 | PROC QUANTSELECT DATA=fc_mart_smp10000; 98 | CLASS product_group launch_month model target_calmonth / PARAM=effect ; 99 | MODEL ape_stat = 100 | product_group|price_index|launch_month|product_age| 101 | model|lead_time|target_calmonth|target_year_shift @1 102 | /QUANTILE = (0.75) 103 | DETAILS=summary 104 | SELECTION=stepwise; 105 | ods select SelectionSummary parameterestimates; 106 | RUN; 107 | 108 | 109 | 110 | 111 | 112 | PROC QUANTSELECT DATA=fc_mart_smp10000; 113 | CLASS product_group launch_month model target_calmonth ; 114 | MODEL ape_stat = 115 | product_group|price_index|launch_month|product_age| 116 | model|lead_time|target_calmonth|target_year_shift @1 117 | /QUANTILE = (0.25 0.5 0.75) 118 | DETAILS=summary 119 | SELECTION=stepwise; 120 | RUN; 121 | 122 | 123 | 124 | PROC HPQUANTSELECT DATA=fc_mart_smp10000; 125 | CLASS product_group launch_month model target_calmonth ; 126 | MODEL ape_stat = 127 | product_group|price_index|launch_month|product_age| 128 | model|lead_time|target_calmonth|target_year_shift @1 129 | /QUANTILE = (0.25 0.5 0.75) ; 130 | selection selection=stepwise; 131 | RUN; 132 | 133 | 134 | 135 | 136 | PROC QUANTREG data=fc_mart_smp10000 algorithm=simplex ; 137 | CLASS Product_Group model ; 138 | MODEL ape_stat_shift = product_group Product_Age model target_year_shift 139 | / QUANTILE=process 140 | PLOT=quantplot(Product_Age) /UNPACK OLS 141 | ; 142 | ods select quantplot; 143 | RUN; 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | **** Sampling; 153 | 154 | DATA fc_mart_1pct_ds; 155 | SET fc_mart; 156 | call streaminit(20653); 157 | IF rand('Uniform') < 0.01 THEN OUTPUT; 158 | RUN; 159 | 160 | 161 | PROC SURVEYSELECT DATA=fc_mart 162 | OUT=fc_mart_1pct_svy 163 | METHOD=srs 164 | SAMPRATE=0.01 165 | SEED=19418 ; 166 | RUN; 167 | 168 | PROC SURVEYSELECT DATA=fc_mart 169 | OUT=fc_mart_smp10000 170 | METHOD=srs 171 | SAMPSIZE=10000 172 | SEED=19416 ; 173 | RUN; 174 | 175 | PROC sort DATA=fc_mart OUT=fc_mart_red_sort; 176 | by model product_group; 177 | RUN; 178 | 179 | 180 | PROC SURVEYSELECT DATA=fc_mart_red_sort 181 | OUT=fc_mart_10pct_strata 182 | METHOD=srs 183 | SAMPRATE =0.10 184 | SEED=20657 ; 185 | STRATA model product_group/ ALLOCATE=prop; 186 | RUN; 187 | -------------------------------------------------------------------------------- /Chapter 14.sas: -------------------------------------------------------------------------------- 1 | 2 | *** 11.4; 3 | data fc_mart; 4 | set fc_mart; 5 | target_year_shift = target_year - 2009; 6 | run; 7 | 8 | 9 | 10 | *** 13.2; 11 | data fc_mart_judgm; 12 | set fc_mart; 13 | 14 | format APE_DIF 8.2; 15 | APE_DIF = ape_judgm - ape_stat; 16 | if APE_DIF ne . and APE_DIF < -500 then APE_DIF = - 500; 17 | else if APE_DIF > 500 then APE_DIF = 500; 18 | 19 | FC_DIF = JudgmFC-statfc; 20 | if FC_DIF ne . and FC_DIF < -5000 then FC_DIF = - 5000; 21 | else if FC_DIF > 5000 then FC_DIF = 5000; 22 | 23 | if JudgmFC > statfc then FC_DIF_SIGN = ' +'; 24 | else if JudgmFC < statfc then FC_DIF_SIGN = '-'; 25 | else FC_DIF_SIGN = ' ='; 26 | 27 | FC_DIF_ABS = abs(FC_DIF); 28 | 29 | FC_DIF_ABS10 = round(FC_DIF_ABS,10); 30 | FC_DIF10 = round(FC_DIF,10); 31 | 32 | format FC_DIF_REL 8.1; 33 | if statfc ne 0 then FC_DIF_REL = judgmfc/statfc * 100; else FC_DIF_REL=.; 34 | if fc_dif_rel > 500 then fc_dif_rel = 500; 35 | else if fc_dif_rel < 0 then fc_dif_rel = .; 36 | 37 | run; 38 | 39 | *** 13.3; 40 | 41 | proc means data=work.fc_mart_judgm mean median std; 42 | var ape_dif fc_dif; 43 | run; 44 | 45 | 46 | 47 | proc sgplot data=fc_mart_judgm; 48 | histogram ape_dif; 49 | run; 50 | 51 | 52 | 53 | proc sgplot data=fc_mart_judgm; 54 | histogram fc_dif; 55 | run; 56 | 57 | 58 | 59 | 60 | proc sgplot data=fc_mart_judgm; 61 | vbox ape_dif / group=fc_dif_sign nooutliers; 62 | refline 0 / axis=y; 63 | yaxis min=-100 max=100; 64 | run; 65 | 66 | 67 | proc means data=fc_mart_judgm noprint nway; 68 | class fc_dif_abs10; 69 | var ape_dif; 70 | output out= abs10_mean median= q3= q1= / autoname; 71 | run; 72 | 73 | 74 | proc sgplot data=abs10_mean; 75 | band x=fc_dif_abs10 lower=ape_dif_q1 upper=ape_dif_q3; 76 | series x=fc_dif_abs10 y=ape_dif_median; 77 | refline 0 / axis=y; 78 | run; 79 | 80 | 81 | 82 | 83 | proc means data=fc_mart_judgm noprint nway; 84 | class fc_dif10; 85 | var ape_dif; 86 | output out= dif10_mean median= q3= q1= / autoname; 87 | run; 88 | 89 | 90 | 91 | proc sgplot data=dif10_mean; 92 | band x=fc_dif10 lower=ape_dif_q1 upper=ape_dif_q3; 93 | series x=fc_dif10 y=ape_dif_median; 94 | refline 0 / axis=y; 95 | run; 96 | 97 | 98 | 99 | 100 | 101 | PROC SGPLOT DATA = fc_mart_judgm; 102 | VBOX ape_dif / CATEGORY=model NOOUTLIERS; 103 | refline 0 / axis=y; 104 | yaxis min=-100 max=100; 105 | RUN; 106 | 107 | 108 | 109 | 110 | proc sql; 111 | select model, 112 | median(ape_dif) as Mean_APE_DIF format = 8.2, 113 | min(create_month) format=yymmp7. as Date_First_Used 114 | from fc_mart_judgm 115 | group by model 116 | order by 3; 117 | quit; 118 | 119 | 120 | 121 | proc format; 122 | value p_age 123 | 7-12 = "7-12" 124 | 13-24 = "13-24" 125 | 25-36 = "25-36" 126 | 37-high = "37-max"; 127 | run; 128 | 129 | 130 | PROC SGPLOT DATA = fc_mart_judgm; 131 | format product_age p_age.; 132 | VBOX ape_dif / CATEGORY=product_age NOOUTLIERS; 133 | refline 0 / axis=y; 134 | yaxis min=-100 max=100; 135 | RUN; 136 | 137 | 138 | 139 | 140 | PROC SGPLOT DATA = fc_mart_judgm; 141 | VBOX ape_dif / CATEGORY=product_group NOOUTLIERS; 142 | refline 0 / axis=y; 143 | yaxis min=-100 max=100; 144 | RUN; 145 | 146 | 147 | *** 13.4; 148 | 149 | 150 | PROC GLMSELECT DATA=fc_mart_judgm ; 151 | MODEL ape_dif = FC_DIF; 152 | RUN; 153 | 154 | 155 | 156 | 157 | PROC GLMSELECT DATA=fc_mart_judgm ; 158 | CLASS fc_dif_sign(ref="=") / PARAM=effect ; 159 | MODEL ape_dif = FC_DIF_ABS fc_dif_sign FC_DIF_ABS*fc_dif_sign 160 | / DETAILS=steps 161 | SELECTION=stepwise 162 | SHOWPVALUES; 163 | RUN; 164 | 165 | 166 | 167 | PROC GLMSELECT DATA=fc_mart_judgm ; 168 | CLASS fc_dif_sign(ref="=") / PARAM=effect ; 169 | MODEL ape_dif = FC_DIF_ABS fc_dif_sign FC_DIF_ABS*fc_dif_sign 170 | / SELECTION=NONE ; 171 | RUN; 172 | 173 | 174 | PROC GLMSELECT DATA=fc_mart_judgm; 175 | format model mid_cmpr.; 176 | CLASS product_group launch_month model 177 | target_calmonth fc_dif_sign(ref="=") / PARAM=effect ; 178 | MODEL ape_dif = FC_DIF_ABS fc_dif_sign FC_DIF_ABS*fc_dif_sign 179 | Product_Group Price_Index LAUNCH_MONTH 180 | Product_Age Model Lead_time 181 | Target_CalMonth Target_Year_Shift 182 | / DETAILS=steps 183 | SELECTION=stepwise 184 | ORDERSELECT 185 | SHOWPVALUES; 186 | ODS OUTPUT ParameterEstimates = ParameterEstimates_DIF 187 | ClassLevelInfo = ClassLevelInfo_DIF; 188 | run; 189 | 190 | 191 | 192 | PROC GLMSELECT DATA=fc_mart_judgm; 193 | format model mid_cmpr.; 194 | CLASS product_group launch_month model 195 | target_calmonth fc_dif_sign(ref="=") / PARAM=effect ; 196 | MODEL ape_dif = FC_DIF_ABS fc_dif_sign FC_DIF_ABS*fc_dif_sign 197 | Product_Group Price_Index LAUNCH_MONTH 198 | Product_Age Model Lead_time 199 | Target_CalMonth Target_Year_Shift 200 | / DETAILS=steps 201 | SELECTION=NONE 202 | ORDERSELECT 203 | SHOWPVALUES; 204 | ODS OUTPUT ParameterEstimates = ParameterEstimates_DIF 205 | ClassLevelInfo = ClassLevelInfo_DIF; 206 | ods select parameterestimates; 207 | run; 208 | 209 | 210 | 211 | %CALC_REFERENCE_CATEGORY( ParmEst = ParameterEstimates_DIF, 212 | ClassLevels = ClassLevelInfo_DIF); 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /Chapter 15.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | proc sql; 6 | create table SameLaunchMonthLookup 7 | as select Launch_Date , 8 | product_group, 9 | count(product_id) as ProductsSameLaunchMonth 10 | from product_base 11 | group by Launch_Date, product_group 12 | order by 1, 2; 13 | 14 | create table product_base_xt 15 | as select a.*, b.ProductsSameLaunchMonth 16 | from product_base as a 17 | left join SameLaunchMonthLookup as b 18 | on a.product_group = b.product_group 19 | and a.Launch_Date = b.Launch_Date 20 | order by 1; 21 | quit; 22 | 23 | 24 | 25 | data Demand_Mart; 26 | merge product_demand 27 | product_base_xt; 28 | by product_id; 29 | 30 | LaunchYear = year(launch_date); 31 | LaunchMonth = month(launch_date); 32 | LaunchYearCent = 2015 - LaunchYear; 33 | Lifetime = intck('MONTH',Launch_Date,yearmonth)+1; 34 | 35 | *** Target CalendarMonth Indicators;; 36 | TargetMonth = month(YearMonth); 37 | TargetJan=(TargetMonth=1); 38 | TargetFeb=(TargetMonth=2); 39 | TargetMar=(TargetMonth=3); 40 | TargetApr=(TargetMonth=4); 41 | TargetMay=(TargetMonth=5); 42 | TargetJun=(TargetMonth=6); 43 | TargetJul=(TargetMonth=7); 44 | TargetAug=(TargetMonth=8); 45 | TargetSep=(TargetMonth=9); 46 | TargetOct=(TargetMonth=10); 47 | TargetNov=(TargetMonth=11); 48 | TargetDec=(TargetMonth=12); 49 | 50 | **** Interaktionen; 51 | LaunchMon_TargetMon = catx('_',put(launchmonth,z02.),put(targetmonth,z02.)); 52 | 53 | if first.product_id then do; 54 | QuantitySum = Quantity; 55 | QuantityMean= Quantity; 56 | i=1; 57 | end; 58 | else do; 59 | QuantitySum + Quantity; 60 | i+1; 61 | QuantityMean = round(QuantitySum / i); 62 | end; 63 | 64 | LastCumQuantity = lag(QuantitySum); 65 | HistQuantityLevel = lag(QuantityMean); 66 | 67 | if first.product_id then do; 68 | LastCumQuantity=.; 69 | HistQuantityLevel=.; 70 | end; 71 | *drop i; 72 | run; 73 | 74 | 75 | 76 | proc means data=demand_mart noprint nway; 77 | class product_Group LifeTime; 78 | var Quantity; 79 | output out=demand_data_pg mean= q1= median= q3= p10= p90= / autoname; 80 | run; 81 | 82 | 83 | proc hpsummary data=demand_mart ; 84 | class product_Group LifeTime; 85 | var Quantity; 86 | output out=demand_data_pg_hp mean= q1= median= q3= p10= p90= / autoname; 87 | run; 88 | 89 | 90 | 91 | 92 | 93 | proc transpose data=demand_mart 94 | out=demand_month_wide(drop= _name_ _label_) 95 | prefix=q; 96 | where lifetime le 12; 97 | by product_id; 98 | var Quantity; 99 | id LifeTime; 100 | run; 101 | 102 | 103 | 104 | data demand_month_wide; 105 | format product_id 8. q1-q12 8.; 106 | set demand_month_wide; 107 | 108 | CQ1=sum(q1); 109 | CQ2=sum(q1,q2); 110 | CQ3=sum(q1,q2,q3); 111 | CQ4=sum(q1,q2,q3,q4); 112 | CQ5=sum(q1,q2,q3,q4,q5); 113 | CQ6=sum(q1,q2,q3,q4,q5,q6); 114 | CQ7=sum(q1,q2,q3,q4,q5,q6,q7); 115 | CQ8=sum(q1,q2,q3,q4,q5,q6,q7,q8); 116 | CQ9=sum(q1,q2,q3,q4,q5,q6,q7,q8,q9); 117 | CQ10=sum(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10); 118 | CQ11=sum(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11); 119 | CQ12=sum(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12); 120 | 121 | run; 122 | 123 | -------------------------------------------------------------------------------- /Chapter 16.sas: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | proc hpgenselect data=demand_mart; 6 | class targetmonth LaunchMonth Product_Group; 7 | model quantity = price_index weight size ProductsSameLaunchMonth LaunchYearCent 8 | product_group targetmonth launchmonth lifetime 9 | /dist=poisson link=log; 10 | selection method=stepwise(slentry=0.01) details=summary; 11 | partition fraction(validate=0.3) / seed=20767; 12 | ods select selectionsummary; 13 | run; 14 | 15 | 16 | 17 | 18 | proc hpgenselect data=demand_mart; 19 | class targetmonth LaunchMonth Product_Group; 20 | model quantity = price_index weight size ProductsSameLaunchMonth LaunchYearCent 21 | product_group targetmonth launchmonth lifetime 22 | /dist=poisson link=log; 23 | selection method=stepwise(slentry=0.01) details=summary; 24 | partition fraction(validate=0.3)/ seed=20767; 25 | ods select parameterestimates; 26 | run; 27 | 28 | 29 | 30 | proc hpgenselect data=demand_mart; 31 | class targetmonth LaunchMonth Product_Group; 32 | model quantity = price_index weight size ProductsSameLaunchMonth LaunchYearCent 33 | product_group targetmonth launchmonth lifetime 34 | /dist=poisson link=log; 35 | selection method=stepwise(slentry=0.01) details=summary; 36 | partition fraction(validate=0.3) / seed=20767;; 37 | id product_id quantity price_index weight size ProductsSameLaunchMonth LaunchYearCent 38 | product_group targetmonth launchmonth LifeTime 39 | LastCumQuantity HistQuantityLevel ; 40 | output out=poisson_Predictions predicted=Quant_Pred Residual=Quant_Resid; 41 | code file="c:\tmp\NewProduct_PoiReg.sas" impute; 42 | run; 43 | 44 | 45 | 46 | proc sgplot data=poisson_Predictions; 47 | vline lifetime / response=quantity stat=mean; 48 | vline lifetime / response=Quant_Pred stat=mean; 49 | where product_group=1; 50 | run; 51 | 52 | 53 | 54 | 55 | 56 | data NewProduct; 57 | do TargetMonth = 1 to 12; 58 | ProductID = 342822; 59 | Price_Index = 50; 60 | Weight = 420; 61 | Size = 15; 62 | productsSameLaunchMonth = 10; 63 | LaunchYearCent = 3; 64 | Product_Group = 21; 65 | LaunchMonth = 11; 66 | Lifetime = TargetMonth; 67 | output; 68 | end; 69 | run; 70 | 71 | 72 | data Scores; 73 | set newproduct; 74 | Format Calendar_Month yymmp7.; 75 | Calendar_Month = intnx('MONTH',mdy(launchmonth,1,2017),lifetime-1); 76 | %include 'c:\tmp\NewProduct_PoiReg.sas'; 77 | run; 78 | 79 | 80 | proc sql; 81 | create table Scores_xt 82 | as select * 83 | from Scores as a 84 | left join demand_data_pg as b 85 | on a.product_group = b.product_group 86 | and a.lifetime = b.lifetime; 87 | quit; 88 | 89 | 90 | proc sql; 91 | select round(sum(p_quantity)) as Forecast_Sum label="Forecast for 11/2017 - 10/2018" format=comma8. 92 | from scores_xt; 93 | quit; 94 | 95 | 96 | 97 | proc sql; 98 | title Forecast by Monat; 99 | select lifetime, round(p_quantity) as Forecast format=comma8. 100 | from scores_xt; 101 | quit; 102 | title; 103 | 104 | 105 | 106 | 107 | proc sgplot data=scores_xt noautolegend; 108 | band lower=quantity_p10 upper= quantity_p90 x=Calendar_Month; 109 | series y=p_quantity x=Calendar_Month; 110 | yaxis label="Product Demand"; 111 | run; 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /Chapter 17.sas: -------------------------------------------------------------------------------- 1 | *** 17.3; 2 | 3 | data NewData; 4 | Product_ID = 1645122; 5 | Product_Group = 21; 6 | Product_Subgroup = "2150"; 7 | Launch_Date = "01APR2018"d; ; 8 | Price_Index = 70; 9 | Weight = 200; 10 | Size = 5; 11 | ProductsSameLaunchMonth = 6; 12 | output; 13 | run; 14 | 15 | 16 | data Feature_Weight; 17 | PG_Wgt = 1; 18 | PSG_Wgt = 0.5; 19 | L_MON_Wgt = 2; 20 | Price_Wgt = 1; 21 | Size_Wgt = 1; 22 | Weight_Wgt = 1; 23 | ProductsSameLaunchMonth_Wgt = 1; 24 | output; 25 | run; 26 | 27 | 28 | 29 | 30 | 31 | proc sql; 32 | create table SimilarMaterials 33 | as select p.Product_ID, 34 | p.Product_Group, 35 | p.Product_Subgroup, 36 | p.Launch_Date, 37 | p.Price_Index, 38 | p.Weight, 39 | p.Size, 40 | p.Designer, 41 | p.Theme, 42 | p.ProductsSameLaunchMonth, 43 | 44 | (p.Product_Group = n.product_Group) * w.PG_Wgt as Product_Group_Score, 45 | (p.Product_Subgroup = n.Product_Subgroup) * w.PSG_Wgt as Product_Subgroup_Score, 46 | (month(p.Launch_Date) = month(n.Launch_Date)) * w.L_MON_Wgt as Launch_Month_Score, 47 | 48 | round(max(0,1-(abs(p.Price_Index-n.Price_Index)/max(p.Price_Index,n.Price_Index)))*w.Price_Wgt,0.01) as Price_Score, 49 | round(max(0,1-(abs(p.Weight-n.Weight)/max(p.Weight,n.Weight)))*w.Weight_Wgt,0.01) as Weight_Score, 50 | round(max(0,1-(abs(p.Size-n.Size)/max(p.Size,n.Size)))*w.Size_Wgt,0.01) as Size_Score, 51 | round(max(0,1-(abs(p.ProductsSameLaunchMonth-n.ProductsSameLaunchMonth)/max(p.ProductsSameLaunchMonth,n.ProductsSameLaunchMonth)))*w.ProductsSameLaunchMonth_Wgt,0.01) as ProductsSameLaunchMonth_Score, 52 | 53 | sum(calculated Product_Group_Score, 54 | calculated Product_Subgroup_Score, 55 | calculated Launch_Month_Score, 56 | calculated Price_Score, 57 | calculated Weight_Score, 58 | calculated Size_Score, 59 | calculated ProductsSameLaunchMonth_Score) as Similarity 60 | 61 | 62 | from NewData as n, 63 | Feature_Weight as w, 64 | Product_Base_xt as p 65 | order by similarity desc; 66 | quit; 67 | 68 | 69 | data SimilarMaterials; 70 | format Rank 8.; 71 | set SimilarMaterials; 72 | Rank = _N_; 73 | run; 74 | 75 | 76 | %let cnt_sim_mat=10; 77 | 78 | *** 17.3.4; 79 | 80 | proc sql; 81 | select rank as Rank, 82 | product_id as Product_ID label = "Product ID", 83 | Similarity as Similarity format = 8.2, 84 | product_Group as Product_Group label = "Product Group", 85 | launch_date as Launch_Date label = "Launch Date" 86 | from SimilarMaterials 87 | where rank <= &Cnt_Sim_Mat; 88 | quit; 89 | 90 | 91 | proc sql; 92 | create table Plot_Similar_Materials 93 | as select s.rank, 94 | s.product_id, 95 | s.product_Group, 96 | s.Launch_Date, 97 | s.Similarity, 98 | d.LifeTime, 99 | d.YearMonth, 100 | d.Quantity 101 | from SimilarMaterials as s, 102 | demand_mart as d 103 | where s.product_id = d.product_id 104 | and s.rank <= &Cnt_Sim_Mat 105 | order by s.rank, d.YearMonth; 106 | quit; 107 | 108 | 109 | 110 | proc sgplot data=work.plot_similar_materials; 111 | series x=LifeTime y=Quantity / group=Product_ID; 112 | run; 113 | 114 | 115 | 116 | 117 | proc sgplot data=work.plot_similar_materials; 118 | vbox Quantity / category=LifeTime connect=median; 119 | run; 120 | 121 | -------------------------------------------------------------------------------- /Chapter 18.sas: -------------------------------------------------------------------------------- 1 | 2 | *** 18.3; 3 | 4 | 5 | 6 | proc sgplot data=work.transactions; 7 | histogram AmountUSD ; 8 | where amountusd < 100000; 9 | run; 10 | 11 | 12 | 13 | *** 18.4; 14 | 15 | DATA Benford_Expected; 16 | FORMAT FirstDigit 8. ExpFreq 8.3; 17 | DO FirstDigit = 1 TO 9; 18 | ExpFreq=(LOG10(1+(1/FirstDigit))*100); 19 | OUTPUT; 20 | END; 21 | RUN; 22 | 23 | 24 | 25 | proc sgplot data=Benford_Expected; 26 | vbar FirstDigit / response=ExpFreq datalabel; 27 | yaxis label="Expected Frequency"; 28 | xaxis label="First Digit"; 29 | run; 30 | 31 | 32 | 33 | DATA Observed_Frequency (KEEP=AmountUSD FirstDigit COUNT); 34 | SET transactions; 35 | FirstDigit= INPUT(SUBSTR(compress(PUT(AmountUSD,16.2),".0 "),1,1),8.); 36 | COUNT=1; 37 | RUN; 38 | 39 | 40 | 41 | 42 | PROC FREQ DATA=Observed_Frequency ; 43 | TABLES FirstDigit/chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) nocum; 44 | ods select OneWayFreqs; 45 | RUN; 46 | 47 | 48 | 49 | 50 | 51 | PROC FREQ DATA=Observed_Frequency ; 52 | TABLES FirstDigit/chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) nocum; 53 | ods select OneWayChiSq; 54 | RUN; 55 | 56 | 57 | 58 | PROC FREQ DATA=Observed_Frequency ; 59 | TABLES FirstDigit/chisq(testp=(30.103 17.609 12.494 9.691 7.918 6.695 5.799 5.115 4.576)) 60 | nocum; 61 | RUN; 62 | 63 | 64 | PROC FREQ DATA=Observed_Frequency ; 65 | TABLES FirstDigit/chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) 66 | nocum out=Benford_Output; 67 | RUN; 68 | 69 | 70 | *** 18.5; 71 | 72 | DATA Benford_Plot; 73 | Format FirstDigit 3. ExpFreq ObsFreq 8.3; 74 | MERGE Benford_Expected 75 | Benford_Output (rename=(percent = ObsFreq)); 76 | BY FirstDigit; 77 | label ObsFreq = "Actual Distribution" 78 | expfreq = "Expected Distribution"; 79 | RUN; 80 | 81 | 82 | proc sgplot data=Benford_Plot; 83 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 84 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 85 | yaxis label="Frequency in Percent"; 86 | xaxis label="First Digit"; 87 | run; 88 | 89 | 90 | 91 | proc sql; 92 | select firstdigit label="First Digit" format = 8., 93 | count label="Frequency" format = 8., 94 | ObsFreq label = "Actual Distribution (%)" format = 8.2, 95 | expfreq label = "Expected Distribution (%)" format = 8.2, 96 | ObsFreq-expfreq as Difference label = "Difference" format = 8.2 97 | from Benford_Plot; 98 | quit; 99 | 100 | 101 | 102 | 103 | *** 18.6; 104 | 105 | Data Digits_1to9; 106 | do FirstDigit=1 to 9; 107 | count=0.000001; 108 | output; 109 | end; 110 | run; 111 | 112 | 113 | 114 | 115 | Data Observed_Frequency_XT; 116 | set Observed_Frequency 117 | Digits_1to9; 118 | run; 119 | 120 | PROC FREQ DATA=Observed_Frequency_XT ; 121 | TABLES FirstDigit/nocum chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) ; 122 | weight count; 123 | RUN; 124 | 125 | 126 | 127 | 128 | Data Observed_Frequency_Without8; 129 | set Observed_Frequency(where=(FirstDigit ne 8)) 130 | Digits_1to9; 131 | run; 132 | 133 | 134 | 135 | PROC FREQ DATA=Observed_Frequency_Without8 ; 136 | TABLES FirstDigit/nocum out=Benford_Output_Without8 137 | chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) ; 138 | weight count; 139 | *ods select OneWayFreqs; 140 | RUN; 141 | 142 | 143 | 144 | 145 | 146 | DATA Benford_Plot_Without8; 147 | Format FirstDigit 3. ExpFreq ObsFreq 8.3; 148 | MERGE Benford_Expected 149 | Benford_Output_Without8 (rename=(percent = ObsFreq)); 150 | BY FirstDigit; 151 | label ObsFreq = "Actual Distribution" 152 | expfreq = "Expected Distribution"; 153 | RUN; 154 | 155 | 156 | proc sgplot data=Benford_Plot_Without8; 157 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 158 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 159 | yaxis label="Frequency in Percent"; 160 | xaxis label="First Digit"; 161 | run; 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /Chapter 19.sas: -------------------------------------------------------------------------------- 1 | 2 | DATA Benford_Expected; 3 | FORMAT FirstDigit 8. ExpFreq 8.3; 4 | DO FirstDigit = 1 TO 9; 5 | ExpFreq=(LOG10(1+(1/FirstDigit))*100); 6 | OUTPUT; 7 | END; 8 | RUN; 9 | 10 | 11 | DATA Observed_Frequency_Customer (KEEP=CustomerID AmountUSD FirstDigit COUNT); 12 | SET transactions; 13 | FirstDigit= INPUT(SUBSTR(compress(PUT(AmountUSD,16.2),".0 "),1,1),8.); 14 | COUNT=1; 15 | RUN; 16 | 17 | proc sort data=Observed_Frequency_Customer; 18 | by CustomerID; 19 | run; 20 | 21 | 22 | PROC FREQ DATA=Observed_Frequency_Customer; 23 | TABLES FirstDigit/nocum out=Benford_Output_CustID(rename=(percent=ObsFreq)) 24 | chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) ; 25 | weight count; 26 | by customerid; 27 | ods output OneWayChiSq=Chi2(drop=table label cvalue); 28 | ods select OneWayChiSq; 29 | RUN; 30 | 31 | 32 | proc transpose data=Chi2 out=Chi2_Results (drop=_name_ df_pchi); 33 | by customerid; 34 | var nValue1; 35 | id name1; 36 | run; 37 | 38 | proc sort data=Chi2_Results; 39 | by descending _pchi_; 40 | run; 41 | 42 | data Chi2_Results; 43 | format Rank 3.; 44 | set Chi2_Results; 45 | Rank = _N_; 46 | rename _pchi_ = Chi2_Value 47 | p_pchi = P_Value; 48 | format p_pchi percent8.3 49 | _pchi_ 8.1; 50 | run; 51 | 52 | 53 | 54 | proc sgplot data=Chi2_Results; 55 | series x=Rank y=P_Value; 56 | yaxis label="Probability Benford (p-Wert)"; 57 | xaxis label="Ranking"; 58 | run; 59 | 60 | 61 | 62 | proc sql; 63 | create table Benford_CustomerID_XT 64 | as select a.customerid, 65 | a.firstdigit, 66 | a.obsfreq format = 8.3, 67 | b.expfreq, 68 | a.obsfreq-b.expfreq as Delta format = 8.3, 69 | c.Rank, 70 | c.Chi2_Value, 71 | c.P_Value 72 | from Benford_Output_CustID as a 73 | left join Benford_Expected as b 74 | on a.firstdigit = b.firstdigit 75 | left join Chi2_Results as c 76 | on a.customerid = c.customerid 77 | order by a.customerid, a.firstdigit; 78 | quit; 79 | 80 | 81 | 82 | proc sgplot data=Benford_CustomerID_XT; 83 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 84 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 85 | yaxis label="Frequency in Percent"; 86 | xaxis label="First Digit"; 87 | where CustomerID = 9000; 88 | run; 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | DATA Observed_Frequency_Cust_Reduced (KEEP=CustomerID AmountUSD FirstDigit COUNT); 97 | SET transactions; 98 | FirstDigit= INPUT(SUBSTR(compress(PUT(AmountUSD,16.2),".0 "),1,1),8.); 99 | if CustomerID = 3000 and FirstDigit=4 then delete; 100 | else if CustomerID = 4000 and FirstDigit=6 then delete; 101 | COUNT=1; 102 | RUN; 103 | 104 | 105 | PROC FREQ DATA=Observed_Frequency_Cust_Reduced noprint ; 106 | TABLES FirstDigit/out=Benford_Observed(RENAME=(PERCENT=OBSERVED)) 107 | nocum; 108 | by CustomerID; 109 | RUN; 110 | 111 | proc timeseries data=Benford_Observed 112 | out =Benford_Observed; 113 | id FirstDigit interval=day setmiss=0.000001 start='02JAN1960'd end='10JAN1960'd; 114 | format FirstDigit 8.; 115 | var count; 116 | by CustomerID; 117 | run; 118 | 119 | -------------------------------------------------------------------------------- /Chapter 20.sas: -------------------------------------------------------------------------------- 1 | 2 | DATA Benford_Expected; 3 | FORMAT FirstDigit 8. ExpFreq 8.3; 4 | DO FirstDigit = 1 TO 9; 5 | ExpFreq=(LOG10(1+(1/FirstDigit))*100); 6 | OUTPUT; 7 | END; 8 | RUN; 9 | 10 | 11 | *** Overall; 12 | 13 | DATA Observed_Frequency_Bank (KEEP=Month Year Amount_Abs FirstDigit COUNT); 14 | SET bank; 15 | FirstDigit= INPUT(SUBSTR(compress(PUT(Amount_Abs,16.2),".0 "),1,1),8.); 16 | COUNT=1; 17 | RUN; 18 | 19 | PROC FREQ DATA=Observed_Frequency_Bank ; 20 | TABLES FirstDigit/chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) 21 | nocum out=Benford_Output_Bank; 22 | weight count; 23 | ods select OneWayFreqs; 24 | RUN; 25 | 26 | DATA Benford_Plot_Bank; 27 | Format FirstDigit 3. ExpFreq ObsFreq 8.3; 28 | MERGE Benford_Expected 29 | Benford_Output_Bank (rename=(percent = ObsFreq)); 30 | BY FirstDigit; 31 | label ObsFreq = "Actual Distribution" 32 | expfreq = "Expected Distribution"; 33 | RUN; 34 | 35 | 36 | proc sgplot data=Benford_Plot_Bank; 37 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 38 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 39 | yaxis label="Frequency in Percent"; 40 | xaxis label="First Digit"; 41 | run; 42 | 43 | 44 | 45 | proc freq data=bank; 46 | table month; 47 | table year; 48 | run; 49 | 50 | 51 | *** Per Year; 52 | 53 | proc sort data=Observed_Frequency_Bank; 54 | by year; 55 | run; 56 | 57 | PROC FREQ DATA=Observed_Frequency_Bank ; 58 | TABLES FirstDigit/chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) 59 | nocum out=Benford_Output_Bank_Year(rename=(percent=obsfreq)); 60 | weight count; 61 | ods output OneWayChiSq=Chi2_Year; 62 | ods select OneWayChiSq; 63 | by year; 64 | RUN; 65 | 66 | 67 | 68 | proc transpose data=Chi2_Year out=Chi2_Results (drop=_name_ df_pchi); 69 | by year; 70 | var nValue1; 71 | id name1; 72 | run; 73 | 74 | proc sort data=Chi2_Results; 75 | by descending _pchi_; 76 | run; 77 | 78 | data Chi2_Year_Results; 79 | format Rank 3.; 80 | set Chi2_Results; 81 | Rank = _N_; 82 | rename _pchi_ = Chi2_Value 83 | p_pchi = P_Value; 84 | format p_pchi percent8.3 85 | _pchi_ 8.1; 86 | run; 87 | 88 | 89 | proc sort data=Chi2_Year_Results; 90 | by year; 91 | run; 92 | 93 | proc sql; 94 | create table Benford_Bank_Year 95 | as select a.Year, 96 | a.firstdigit, 97 | a.obsfreq format = 8.3, 98 | b.expfreq, 99 | a.obsfreq-b.expfreq as Delta format = 8.3 100 | from Benford_Output_Bank_Year as a 101 | left join Benford_Expected as b 102 | on a.firstdigit = b.firstdigit 103 | order by a.year, a.firstdigit; 104 | quit; 105 | 106 | 107 | proc sgplot data=Benford_Bank_Year; 108 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 109 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 110 | yaxis label="Frequency in Percent"; 111 | xaxis label="First Digit"; 112 | where year = 2014; 113 | run; 114 | 115 | 116 | 117 | proc sgplot data=Benford_Bank_Year; 118 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 119 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 120 | yaxis label="Frequency in Percent"; 121 | xaxis label="First Digit"; 122 | where year = 2012; 123 | run; 124 | 125 | 126 | *** Per Month; 127 | 128 | proc sort data=Observed_Frequency_Bank; 129 | by month; 130 | run; 131 | 132 | PROC FREQ DATA=Observed_Frequency_Bank ; 133 | TABLES FirstDigit/chisq(testp=Benford_Expected(rename=(ExpFreq=_testp_))) 134 | nocum out=Benford_Output_Bank_Month(rename=(percent=obsfreq)); 135 | weight count; 136 | ods output OneWayChiSq=Chi2_Month; 137 | ods select OneWayChiSq; 138 | by month; 139 | RUN; 140 | 141 | 142 | 143 | proc transpose data=Chi2_Month out=Chi2_Results (drop=_name_ df_pchi); 144 | by month; 145 | var nValue1; 146 | id name1; 147 | run; 148 | 149 | proc sort data=Chi2_Results; 150 | by descending _pchi_; 151 | run; 152 | 153 | data Chi2_Month_Results; 154 | format Rank 3.; 155 | set Chi2_Results; 156 | Rank = _N_; 157 | rename _pchi_ = Chi2_Value 158 | p_pchi = P_Value; 159 | format p_pchi percent8.3 160 | _pchi_ 8.1; 161 | run; 162 | 163 | 164 | 165 | proc sgplot data=Chi2_Month_Results; 166 | vbar month / response=P_Value; 167 | run; 168 | 169 | 170 | 171 | proc sql; 172 | create table Benford_Bank_Month 173 | as select a.month, 174 | count(a.month) as Frequency, 175 | a.firstdigit, 176 | a.obsfreq format = 8.3, 177 | b.expfreq, 178 | a.obsfreq-b.expfreq as Delta format = 8.3 179 | from Benford_Output_Bank_Month as a 180 | left join Benford_Expected as b 181 | on a.firstdigit = b.firstdigit 182 | order by a.month, a.firstdigit; 183 | quit; 184 | 185 | 186 | 187 | proc sgplot data=Benford_Bank_Month; 188 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 189 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 190 | yaxis label="Frequency in Percent"; 191 | xaxis label="First Digit"; 192 | where Month = 6; 193 | run; 194 | 195 | 196 | 197 | 198 | proc sgplot data=Benford_Bank_Month; 199 | vline FirstDigit / response=ObsFreq lineattrs=(thickness=3 ) transparency=0.2; 200 | vline FirstDigit / response=ExpFreq lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 201 | yaxis label="Frequency in Percent"; 202 | xaxis label="First Digit"; 203 | where Month = 1; 204 | run; 205 | 206 | 207 | 208 | *** Vorgabe Sales Daten; 209 | 210 | 211 | proc freq data=sales_historic; 212 | table month / nocum out=HistoricDemand(rename=(percent=HistoricPct)); 213 | weight Sales_EUR; 214 | run; 215 | 216 | 217 | 218 | 219 | proc sgplot data=HistoricDemand; 220 | vbar month / response=HistoricPct; 221 | run; 222 | 223 | 224 | 225 | 226 | proc freq data=sales_month; 227 | by AccountManager; 228 | table month / nocum out=Sales_AccMgr chisq(testp=HistoricDemand(rename=(HistoricPct=_testp_))); 229 | weight Sales_EUR; 230 | ods output OneWayChiSq=Chi2_AccMgr(drop=table label cvalue); 231 | ods select OneWayChiSq; 232 | run; 233 | 234 | 235 | proc transpose data=Chi2_AccMgr out=Chi2_Results (drop=_name_ df_pchi); 236 | by AccountManager; 237 | var nValue1; 238 | id name1; 239 | run; 240 | 241 | proc sort data=Chi2_Results; 242 | by descending _pchi_; 243 | run; 244 | 245 | 246 | data Chi2_AccMgr_Results; 247 | format Rank 3.; 248 | set Chi2_Results; 249 | Rank = _N_; 250 | rename _pchi_ = Chi2_Value 251 | p_pchi = P_Value; 252 | format p_pchi percent8.3 253 | _pchi_ 8.1; 254 | run; 255 | 256 | 257 | proc sql; 258 | create table AccMgr_XT 259 | as select a.AccountManager, 260 | a.month, 261 | a.Sales_EUR as Sales_EUR_Obs format = 8., 262 | b.Count/11 as Sales_Eur_Exp format = 8. 263 | from sales_month as a 264 | left join HistoricDemand as b 265 | on a.month = b.month 266 | order by a.AccountManager, a.Month; 267 | quit; 268 | 269 | 270 | 271 | proc sgplot data=AccMgr_XT; 272 | vline Month / response=Sales_EUR_Obs lineattrs=(thickness=3 ) transparency=0.2; 273 | vline Month / response=Sales_Eur_Exp lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 274 | yaxis max=3000; 275 | by AccountManager; 276 | where AccountManager = 'Jeffrey'; 277 | run; 278 | 279 | 280 | 281 | 282 | proc sgplot data=AccMgr_XT; 283 | vline Month / response=Sales_EUR_Obs lineattrs=(thickness=3 ) transparency=0.2; 284 | vline Month / response=Sales_Eur_Exp lineattrs=(thickness=3 pattern=2 color=grey ) transparency=0.5 ; 285 | yaxis max=3000; 286 | by AccountManager; 287 | where AccountManager = 'Joyce'; 288 | run; 289 | 290 | 291 | 292 | proc sgplot data=AccMgr_XT; 293 | vbar Month /response=Sales_EUR_Obs ; 294 | vline Month /response=Sales_Eur_Exp lineattrs=(thickness=5 color=black) transparency=0.5 ; 295 | by AccountManager; 296 | run; 297 | 298 | 299 | 300 | 301 | 302 | -------------------------------------------------------------------------------- /Chapter 21.sas: -------------------------------------------------------------------------------- 1 | 2 | *** 21.3 Data; 3 | data claims_feature(keep = policyno feature); 4 | set claims_nodup; 5 | format Feature $40.; 6 | *** 1. Gender; 7 | if gender = 'M' then Feature = 'Male'; 8 | else Feature = 'Female'; 9 | output; 10 | *** 2. Age; 11 | if 0 < Age < 26 then feature = 'Young'; 12 | else if 26 <= age <= 55 then feature = 'Middle Age'; 13 | else feature = 'Old'; 14 | output; 15 | *** 3. Density; 16 | feature = Density; output; 17 | *** 4. Car Type; 18 | feature = Car_type; output; 19 | *** 5. Car Use; 20 | feature = Car_use; output; 21 | *** 6. Claim Flag; 22 | if clm_flag = 'Yes' then feature = 'Claim'; 23 | else feature = 'No Claim'; 24 | output; 25 | run; 26 | 27 | *** 21.3.3 Transpose; 28 | 29 | data class; 30 | format PersonID 3.; 31 | set sashelp.class; 32 | PersonID = _N_; 33 | Weight=round(weight,10); 34 | Height=round(height,5); 35 | run; 36 | 37 | proc transpose data=class out=class_tp; 38 | by PersonID name; 39 | var sex age height weight; 40 | run; 41 | 42 | data Key_Value; 43 | set class_tp; 44 | rename _name_ = Key; 45 | Value = strip(col1); 46 | drop col1; 47 | Feature = catx('=',_name_,Value); 48 | run; 49 | 50 | 51 | 52 | *** 21.4.3; 53 | 54 | 55 | /***************************************************************************************** 56 | *** This code only runs inside a SAS Code Node in SAS Enterprise Miner !!! 57 | ***************************************************************************************** 58 | 59 | 60 | proc sql noprint; 61 | select count(distinct(%EM_ID)) 62 | into :transN 63 | from &EM_IMPORT_TRANSACTION; 64 | quit; 65 | 66 | 67 | data work.ChiSquare; 68 | set &EM_IMPORT_RULES; 69 | CHISQ = .; 70 | PVALUE = .; 71 | if NOT (CONF=SUPPORT or LIFT=CONF) then do; 72 | CHISQ = (&transN * (LIFT-1)**2)*((SUPPORT/100) * (CONF/100)) 73 | /((CONF/100 - SUPPORT/100) * (LIFT - CONF/100)); 74 | PVALUE = 1-Probchi(CHISQ,1); 75 | end; 76 | run; 77 | 78 | 79 | proc sql; 80 | create table AssocRuleTable_Claims 81 | as 82 | select Index, 83 | Rule, 84 | _lhand, 85 | _rhand, 86 | count, 87 | support, 88 | exp_conf, 89 | conf, 90 | lift, 91 | pvalue format = 8.4 92 | from ChiSquare; 93 | quit; 94 | 95 | 96 | 97 | 98 | *****************************************************************************************/ -------------------------------------------------------------------------------- /Chapter 22.sas: -------------------------------------------------------------------------------- 1 | 2 | *** 22.3; 3 | 4 | 5 | OPTION VALIDVARNAME = V7; 6 | 7 | data claims_feature_xt; 8 | set claims_feature; 9 | feature = compress(feature); 10 | count=1; 11 | run; 12 | 13 | proc transpose data=Claims_feature_xt 14 | out=Claims_1row(drop=_name_); 15 | by policyno; 16 | id feature; 17 | var count; 18 | run; 19 | 20 | 21 | data claims_1row; 22 | set claims_1row; 23 | %replace_mv(Claim Commercial Female HighlyRural HighlyUrban Male MiddleAge 24 | NoClaim Old PanelTruck Pickup Private Rural SUV Sedan SportsCar 25 | Urban Van Young); 26 | run; 27 | 28 | 29 | *** 22.3; 30 | 31 | data claims_1row_method2; 32 | set claims_nodup; 33 | 34 | *** 1. Gender; 35 | if Gender='M' then Male=1; else Male=0; 36 | if Gender='F' then Female=0; else Female=0; 37 | 38 | Male=(Gender='M'); 39 | Female=(Gender='F'); 40 | 41 | *** 2. Age; 42 | Young = (0 < Age < 26); ; 43 | MiddleAge= (26 <= age <= 55); 44 | Old = (Age > 55); 45 | run; 46 | 47 | 48 | proc logistic data=claims_nodup 49 | outdesign=claims_1row_method3 50 | outdesignonly; 51 | class car_type car_use density gender clm_flag / param=glm; 52 | model policyno= car_type car_use density gender clm_flag / NOINT; 53 | run; 54 | 55 | 56 | *** 22.4; 57 | 58 | 59 | proc varclus data=claims_1row 60 | outtree=varclus_tree1 61 | centroid maxc=5 minc=5; 62 | var Claim Commercial Female HighlyRural HighlyUrban Male MiddleAge NoClaim 63 | Old PanelTruck Pickup Private Rural SUV Sedan SportsCar Urban Van Young; 64 | ods select ClusterSummary rsquare; 65 | run; 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | proc tree data=varclus_tree1 horizontal ; 77 | height _propor_; 78 | run; 79 | 80 | 81 | -------------------------------------------------------------------------------- /Chapter 23.sas: -------------------------------------------------------------------------------- 1 | 2 | data patients_mart; 3 | set patients; 4 | 5 | if cnt_aes = . then Cnt_AES=0; 6 | if Cnt_AES_Severe= . then cnt_aes_severe=0; 7 | 8 | Duration=intck('MONTH',startdate,'31DEC2004'd); 9 | 10 | TimeTillDeath=intck('MONTH',startdate,dth_date); 11 | TimeTillRecur=intck('MONTH',startdate,rec_date); 12 | Died=(TimeTillDeath ne .); 13 | Recur = (timetillrecur ne .); 14 | 15 | format age_grp $10.; 16 | if age < 40 then age_grp='Young'; 17 | else if age < 60 then age_grp='Midlife'; 18 | else age_grp='Old'; 19 | format Rec_Grp Dth_Grp $16.; 20 | 21 | if died = 0 then do; 22 | if duration < 55 then Dth_Grp = 'Dth_None_Short'; 23 | else Dth_Grp = 'Dth_None_Long'; 24 | end; 25 | else do; 26 | if timetilldeath < 27 then Dth_Grp = 'Dth_Early'; 27 | else Dth_Grp = 'Dth_Late'; 28 | end; 29 | 30 | if recur = 0 then do; 31 | if duration < 54 then Rec_Grp = 'Rec_None_Short'; 32 | else Rec_Grp = 'Rec_None_Long'; 33 | end; 34 | else do; 35 | if timetillrecur < 12 then Rec_Grp = 'Rec_Early'; 36 | else Rec_Grp = 'Rec_Late'; 37 | end; 38 | 39 | format weightgrp $15.; 40 | if sex=0 then do; 41 | if weight < 77 then WeightGrp='Light'; 42 | else if weight < 91 then WeightGrp='MiddleWeight'; 43 | else weightgrp='Heavy'; 44 | end; 45 | else do; 46 | if weight < 61 then WeightGrp='Light'; 47 | else if weight < 78 then WeightGrp='MiddleWeight'; 48 | else weightgrp='Heavy'; 49 | end; 50 | 51 | format br_group $10.; 52 | if breslow < 1.8 then br_group='Thin'; 53 | else if breslow < 3.3 then br_group='MediumB'; 54 | else br_group='Thick'; 55 | 56 | format medication $8.; 57 | if tre_code = 'A' then medication='Placebo'; 58 | else medication='Verum'; 59 | 60 | drop startdate; 61 | drop dth_date rec_date; 62 | 63 | if cnt_aes <= 1 then AES_GRP = 'Max1AE'; 64 | else if cnt_aes <= 5 then AES_GRP = 'Max5AES'; 65 | else AES_GRP = 'GT5AES'; 66 | 67 | if cnt_aes_severe = 0 then AES_SEVERE_GRP = 'NoSevereAE'; 68 | else AES_SEVERE_GRP = 'SevereAE'; 69 | run; 70 | 71 | data patients_feature(Keep=pnr feature); 72 | set patients_mart; 73 | format feature $20.; 74 | feature = age_grp; output; 75 | feature = weightgrp; output; 76 | if sex=0 then feature='Male'; 77 | else feature = 'Female'; output; 78 | feature = br_group; output; 79 | feature = medication; output; 80 | feature = aes_severe_Grp; output; 81 | feature = aes_grp; output; 82 | feature = Rec_Grp; output; 83 | feature = Dth_grp; output; 84 | run; 85 | 86 | data patients_feature_xt; 87 | set patients_feature; 88 | feature = compress(feature); 89 | count=1; 90 | run; 91 | 92 | proc transpose data=patients_feature_xt out=patients_1row(drop=_name_); 93 | by pnr; 94 | id feature; 95 | var count; 96 | run; 97 | 98 | 99 | data patients_1row; 100 | set patients_1row; 101 | %replace_mv( 102 | Dth_Early Dth_Late Dth_None_Long Dth_None_Short Female GT5AES Heavy 103 | Light Male Max1AE Max5AE MediumB MiddleWeight Midlife NoSevereAE 104 | Old Placebo Rec_Early Rec_Late Rec_None_Long Rec_None_Short SevereAE 105 | Thick Thin Verum Young ); 106 | run; 107 | 108 | 109 | 110 | proc varclus data=patients_1row outtree=varclus_tree1 centroid; 111 | var Dth_Early Dth_Late Dth_None_Long Dth_None_Short Female GT5AES Heavy 112 | Light Male Max1AE Max5AE MediumB MiddleWeight Midlife NoSevereAE 113 | Old Placebo Rec_Early Rec_Late Rec_None_Long Rec_None_Short SevereAE 114 | Thick Thin Verum Young ; 115 | run; 116 | 117 | proc tree data=varclus_tree1 horizontal ; 118 | height _propor_; 119 | run; 120 | -------------------------------------------------------------------------------- /Chapter 24.sas: -------------------------------------------------------------------------------- 1 | *** 24.5 - IML Version; 2 | proc iml; 3 | use projects; read all; close; 4 | 5 | N = nrow(prob); /* number of projects */ 6 | ScenarioID = t(1:2**N); 7 | format = "binary" + strip(char(N)); 8 | bin = putn(ScenarioID,format); 9 | 10 | bt=j(2**N,N,-1); 11 | do i = 1 to N; 12 | bt[,i]=num(substr(bin,N-i+1,1)); 13 | end; 14 | prob_m = abs(1-bt-t(prob)); 15 | 16 | ScenarioSum = bt * value; 17 | ScenarioProb = prob_m[,#]; 18 | TotalDealsizeRounded = round(ScenarioSum,100); 19 | 20 | create FullCalc_Outcomes_IML var {ScenarioID ScenarioSum TotalDealsizeRounded ScenarioProb}; 21 | append; 22 | close FullCalc_Outcomes_IML; 23 | quit; 24 | 25 | 26 | 27 | proc sgplot data=FullCalc_Outcomes_IML; 28 | title "Distribution of Scenario-Outcomes"; 29 | footnote Full Calculation; 30 | histogram TotalDealsizeRounded / binstart=0 binwidth=100 weight =scenarioprob; 31 | refline 1000 2400 3000 / axis=x label=('Fired' 'Bonus' 'Promotion'); 32 | xaxis max=12500; 33 | run; 34 | 35 | 36 | 37 | proc format; 38 | value sales 39 | low - 1000 = '1. FIRED' 40 | 1001 - 2400 = '2. OK' 41 | 2401 - 3000 = '3. BONUS' 42 | 3001 - high = '4. PROMOTION'; 43 | run; 44 | 45 | 46 | proc freq data=FullCalc_Outcomes_IML; 47 | title Frequencies per Outcome (Category); 48 | format ScenarioSum sales.; 49 | table ScenarioSum / nocum; 50 | weight scenarioprob; 51 | run; 52 | 53 | 54 | 55 | *** 24.7 Datastep Version; 56 | 57 | 58 | 59 | 60 | *** Calculate Number of Projects; 61 | proc sql noprint; 62 | select put(count(*),8.-L)into :n_proj from projects; 63 | quit; 64 | 65 | *** Create Row of Project Probs; 66 | proc transpose data=projects prefix=prob out=tp_prob(drop=_name_); 67 | var prob; 68 | id ProjectID; 69 | run; 70 | 71 | *** Create Row of Project Values; 72 | proc transpose data=projects prefix=value out=tp_value(drop=_name_); 73 | var value; 74 | id ProjectID; 75 | run; 76 | 77 | *** Create Matrix with [#Scenarios,value+probs]; 78 | data value_prob; 79 | format ScenarioID 8.; 80 | set tp_value; 81 | set tp_prob; 82 | do ScenarioID = 1 to 2**&n_proj; output; end; 83 | run; 84 | 85 | *** FullCalc_Outcome Mart; 86 | data FullCalc_Outcomes_Datastep; 87 | set value_prob; 88 | *** Define Arrays; 89 | array ind[&n_proj] ind1-ind&n_proj; ** Project y/n Indicator; 90 | array prob[&n_proj] prob1-prob&n_proj; ** Project Success Probability; 91 | array value[&n_proj] value1-value&n_proj; ** Project Value; 92 | array scn_value[&n_proj] scn_value1-scn_value&n_proj; ** Scenario Project Value (with YN); 93 | array scn_prob[&n_proj] scn_prob1-scn_prob&n_proj; ** Scenario Probabilty (with YN); 94 | bin = put(ScenarioID,binary%eval(&n_proj.).); ** Derive Binary String of ID; 95 | ScenarioProb = 1; ** Initialize Scenario Prob; 96 | do i = 1 to &n_proj; 97 | ind[i]=substr(bin,&n_proj.+1-i,1); ** Fill Indicator with respective Char of String; 98 | scn_value[i] = ind[i]*value[i]; ** Calculate Scenario Value; 99 | if ind[i] = 1 then scn_prob[i] = prob[i]; ** Calculate Scenario Probability; 100 | else scn_prob[i] = 1-prob[i]; 101 | ScenarioProb = ScenarioProb * scn_prob[i]; ** Iteratively Multiply Scenario Probs ("AND" Probability); 102 | end; 103 | ScenarioSum = sum(of scn_value1-scn_value&n_proj); ** Sum over Scenario Values; 104 | TotalDealsizeRounded = round(ScenarioSum,100); 105 | drop i; 106 | run; 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /Chapter 25.sas: -------------------------------------------------------------------------------- 1 | 2 | %let n_sim = 10000; 3 | 4 | 5 | proc iml; 6 | use projects; 7 | read all; 8 | close; 9 | 10 | call randseed(20173); ** Init Seed; 11 | 12 | n_proj = nrow(prob); 13 | ScenarioID = t(1:&n_sim); 14 | prob_cv = repeat(prob,1,&n_sim); 15 | value_cv = repeat(value,1,&n_sim); 16 | rnduni = j(n_proj, &n_sim); 17 | call randgen(rnduni,'Uniform'); 18 | OutcomeValueMatrix=Value_CV#(rnduni 2 | 3 | # Applying Data Science - Business Case Studies using SAS 4 | 5 | Applying Data Science Methods to Real Life Business Use Cases. Companion and Download Site for the [SAS Press Book](https://www.sas.com/store/books/categories/usage-and-reference/applying-data-science-business-case-studies-using-sas-/prodBK_63165_en.html?storeCode=SAS_US) "Applying Data Science - Business Case Studies using SAS" by Gerhard Svolba. [--> amazon.com](https://www.amazon.com/Applying-Data-Science-Business-Studies-ebook/dp/B06Y5QY872/ref=sr_1_1?qid=1550842820) 6 | 7 | * Presentations of all case studies (and more) have also been recorded in my Data Science Webinar on [Youtube](https://www.youtube.com/playlist?list=PLdMxv2SumIKs0A2cQLeXg1xb9OVE8e2Yq). 8 | * Contributions at SAS Communities on content from this book 9 | 10 | [Encoding of CLASS Variables in Regression Analysis - Better understand the ORDINAL encoding](https://communities.sas.com/t5/SAS-Communities-Library/Encoding-of-CLASS-Variables-in-Regression-Analysis-Better/ta-p/632923) 11 | 12 | [Display the hidden estimate for the reference category in EFFECT coding for better interpretability](https://communities.sas.com/t5/SAS-Communities-Library/Display-the-hidden-estimate-for-the-reference-category-in-EFFECT/ta-p/633865) 13 | 14 | [%CALC_REFERENCE_CATEGORY displays the "hidden" coefficient in EFFECT encoding for CLASS variables](https://communities.sas.com/t5/SAS-Communities-Library/CALC-REFERENCE-CATEGORY-displays-the-quot-hidden-quot/ta-p/633496) 15 | 16 | [Simulate timeseries data with a SAS DATA Step and SAS Functions](https://communities.sas.com/t5/SAS-Communities-Library/Simulate-timeseries-data-with-a-SAS-DATA-Step-and-SAS-Functions/ta-p/633852) 17 | 18 | [Automatically highlight data-driven events with reference lines in line-charts](https://communities.sas.com/t5/SAS-Communities-Library/Automatically-highlight-data-driven-events-with-reference-lines/ta-p/645944) 19 | 20 | * [Getting More Insight into Your Forecast Errors with the GLMSELECT and 21 | QUANTSELECT Procedures](https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1673-2018.pdf) 22 | * [Other books](https://support.sas.com/en/books/authors/gerhard-svolba.html) from Gerhard Svolba at SAS Press. 23 | * [Data Preparation for Data Science Using SAS](https://github.com/gerhard1050/Data-Preparation-for-Data-Science-Using-SAS) 24 | * [Data Quality for Data Science Using SAS](https://github.com/gerhard1050/Data-Quality-for-Data-Science-Using-SAS) 25 | * [Top 10 bestselling titles at SAS Global Forum 2018](https://blogs.sas.com/content/sastraining/2018/05/08/top-10-bestselling-titles-at-sas-global-forum-2018/) 26 | 27 | ## Overview 28 | This is the new SAS Press book of Gerhard Svolba. It contains 8 case studies in 28 practical chapters with business explainations, methodological considerations and lots of SAS Code. 29 | 30 | Why you want to read this book: 31 | * This book reflects the author's enthusiasm to use analytical and data science methods to solve business questions and to implement the solution using SAS. 32 | * It shows you the benefits of analytics, how to gain more insight into your data, and how to make better decisions. In eight entertaining and real-world case studies, Svolba combines data science and advanced analytics with business questions, illustrating them with data and SAS code. 33 | * Written for business analysts, statisticians, data miners, data scientists, and SAS programmers, Applying Data Science bridges the gap between high-level, business-focused books that skimp on the details and technical books that only show SAS code with no business context. 34 | 35 | This book is written for a variety of different persona groups and profiles. 36 | * Business Analysts and Business Experts: Businesspeople can review the examples and see what can be achieved with analytical methods. They get insight into the power of analytics and the additional findings that can be generated by these methods. They might not study the SAS implementation and the code in much detail. They would rather hand over the implementation examples to their data scientist to give them a quick start to apply the methods. 37 | * Statisticians, Data Miners, Data Scientists, and Quantitative Experts: This group of people might be interested to see how analytical methods can be applied to real-world business questions. They learn how analytical methods that are established in a certain industry might be applied to other areas. They see practical situations and constraints that they can expect to encounter when they apply data science methods. 38 | * SAS Programmers: The book contains a lot of SAS code, including SAS macros, SAS DATA step code for data preparation, SAS analytics procedures, and SAS graph procedures. In this code SAS programmers can find new ways to solve certain problems in SAS and transfer the solutions in these examples to their day-to-day problems 39 | 40 | 41 | - [Book Excerpt](https://www.sas.com/storefront/aux/en/spba/63165_excerpt.pdf) 42 | - [Table of Contents](https://www.sas.com/storefront/aux/en/spba/63165_toc.pdf) 43 | 44 | ## Changes, Improvements and Typos in the printed version of the book 45 | Please send any findings potential typos and necessary changes to the author. Email: sastools.by.gerhard@gmx.net 46 | 47 | Note that the downloadable code files from github already contain these changes. 48 | 49 | 50 | 51 | * Page 16 and 17: The PROC LIFETEST statement has the brackets around HAZARD and MAXTIME set in a wrong way. 52 | Here is the correct version for both PROC LIFETEST calls in section 1.7.2 and 1.7.3 53 | 54 | PROC LIFETEST DATA=employees plots=(hazard(bandwidth=3)) maxtime=120; 55 | 56 | Thanks to __Nicole Fox__ for pointing this out! 57 | 58 | 59 | 60 | * Page 54: The datastep at the beginning of chapter 3.5.2 should use variable _ _T_ _ instead of variable TIME. Here is the correct version. 61 | 62 | data employees_expanded; 63 | 64 | set employees; 65 | 66 | do _ _T_ _ = 1 to duration; 67 | 68 | if TIME NE duration then Event = 0; 69 | 70 | else Event = Resigned; 71 | 72 | output; 73 | 74 | end; 75 | 76 | run; 77 | 78 | 79 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_airlinepassengerssmooth.sas: -------------------------------------------------------------------------------- 1 | data WORK.AIRLINEPASSENGERSSMOOTH; 2 | infile datalines dsd truncover; 3 | input TIME:32. pass_smooth_backw:8.1 pass_smooth_backwTr:8.1 pass_smooth_centerWgt:8.1 pass_smooth_centerWgtTr:8.1 Date:YYMMN6. Passengers:8.1 Nflights:8.; 4 | format TIME:32. pass_smooth_backw:8.1 pass_smooth_backwTr:8.1 pass_smooth_centerWgt:8.1 pass_smooth_centerWgtTr:8.1 Date:YYMMN6. Passengers:8.1 Nflights:8.; 5 | datalines4; 6 | 0,37208190,,41159391,,199001,37208190,18592 7 | 1,36643292,,42014267,,199002,36078394,18168 8 | 2,39147040,,42167837,,199003,44154535,18218 9 | 3,39699174,,41967794,,199004,41355578,17334 10 | 4,40006324,,41798652,,199005,41234923,17375 11 | 5,40703704,,41586307,,199006,44190605,18232 12 | 6,41465505,,41438427,41438427,199007,46036310,17770 13 | 7,42390585,,41298779,41298779,199008,48866148,17361 14 | 8,42012661,,41076618,41076618,199009,38989264,19074 15 | 9,41936147,,40810751,40810751,199010,41247525,17671 16 | 10,41700690,,40745995,40745995,199011,39346113,16902 17 | 11,41504133,41504133,40720347,40720347,199012,39342008,19386 18 | 12,41463173,41463173,40687392,40687392,199101,36716670,19046 19 | 13,41264025,41264025,40655313,40655313,199102,33688621,16961 20 | 14,40874270,40874270,40501267,40501267,199103,39477477,17005 21 | 15,40751150,40751150,40507199,40507199,199104,39878137,17698 22 | 16,40733143,40733143,40397767,40397767,199105,41018839,16761 23 | 17,40647774,40647774,40413116,40413116,199106,43166181,17259 24 | 18,40622039,40622039,40452848,40452848,199107,45727485,16804 25 | 19,40533409,40533409,40518358,40518358,199108,47802583,16682 26 | 20,40503327,40503327,40761519,40761519,199109,38628284,17811 27 | 21,40496890,40496890,40841432,40841432,199110,41170282,17301 28 | 22,40339036,40339036,40880779,40880779,199111,37451867,16594 29 | 23,40490478,40490478,41127864,41127864,199112,41159310,18696 30 | 24,40490692,40490692,41589243,41589243,199201,36719242,18403 31 | 25,40663131,40663131,42078313,42078313,199202,35757887,17089 32 | 26,40861770,40861770,42360441,42360441,199203,41861145,17413 33 | 27,40842854,40842854,42576712,42576712,199204,39651142,17501 34 | 28,40908013,40908013,42676595,42676595,199205,41800746,16566 35 | 29,41263432,41263432,42776017,42776017,199206,47431207,17919 36 | 30,41770007,41770007,42804093,42804093,199207,51806387,17825 37 | 31,42216773,42216773,42896213,42896213,199208,53163782,17614 38 | 32,42540300,42540300,43074112,43074112,199209,42510606,19318 39 | 33,42630597,42630597,43282062,43282062,199210,42253840,17397 40 | 34,42806809,42806809,43545129,43545129,199211,39566414,16715 41 | 35,42781022,42781022,43641377,43641377,199212,40849861,19504 42 | 36,42931840,42931840,43537929,43537929,199301,38529065,18748 43 | 37,42996944,42996944,43364151,43364151,199302,36539132,17391 44 | 38,43156452,43156452,43216255,43216255,199303,43775242,17854 45 | 39,43445946,43445946,43414702,43414702,199304,43125070,18869 46 | 40,43654300,43654300,43669247,43669247,199305,44300992,16850 47 | 41,43562946,43562946,43937984,43937984,199306,46334965,18324 48 | 42,43369302,43369302,44123159,44123159,199307,49482654,16981 49 | 43,43183497,43183497,44306754,44306754,199308,50934128,16806 50 | 44,43254646,43254646,44717905,44717905,199309,43364388,19233 51 | 45,43561064,43561064,45038205,45038205,199310,45930858,17171 52 | 46,43827978,43827978,45324372,45324372,199311,42769377,17237 53 | 47,44079856,44079856,45669729,45669729,199312,43872406,19672 54 | 48,44257918,44257918,46064330,46064330,199401,40665800,19146 55 | 49,44485023,44485023,46419396,46419396,199402,39264392,18101 56 | 50,44917410,44917410,46645878,46645878,199403,48963885,18528 57 | 51,45167356,45167356,46952534,46952534,199404,46124425,18536 58 | 52,45465873,45465873,47223889,47223889,199405,47883199,16936 59 | 53,45817507,45817507,47555971,47555971,199406,50554571,17764 60 | 54,46196164,46196164,47848645,47848645,199407,54026538,16987 61 | 55,46512980,46512980,48102149,48102149,199408,54735918,16366 62 | 56,46809176,46809176,48388104,48388104,199409,46918744,18065 63 | 57,47083300,47083300,48575826,48575826,199410,49220347,16928 64 | 58,47414355,47414355,48795145,48795145,199411,46742038,16441 65 | 59,47733347,47733347,48999838,48999838,199412,47700305,18377 66 | 60,48068463,48068463,49161970,49161970,199501,44687190,18091 67 | 61,48287832,48287832,49288342,49288342,199502,41896823,17528 68 | 62,48456313,48456313,49313753,49313753,199503,50985658,16913 69 | 63,48713673,48713673,49429059,49429059,199504,49212746,16936 70 | 64,48875432,48875432,49526670,49526670,199505,49824307,15917 71 | 65,49069317,49069317,49660541,49660541,199506,52881186,17495 72 | 66,49146911,49146911,49731147,49731147,199507,54957670,16394 73 | 67,49301005,49301005,49982821,49982821,199508,56585046,16265 74 | 68,49366909,49366909,50491149,50491149,199509,47709592,17431 75 | 69,49481529,49481529,50798839,50798839,199510,50595784,16820 76 | 70,49612236,49612236,51102964,51102964,199511,48310520,16000 77 | 71,49733728,49733728,51425487,51425487,199512,49158213,17991 78 | 72,49820031,49820031,51706187,51706187,199601,45722827,17737 79 | 73,50256137,50256137,51983679,51983679,199602,47130093,17476 80 | 74,50666422,50666422,52106279,52106279,199603,55909079,16990 81 | 75,50931204,50931204,52352050,52352050,199604,52390127,17519 82 | 76,51260622,51260622,52448088,52448088,199605,53777332,16287 83 | 77,51528460,51528460,52648206,52648206,199606,56095234,17996 84 | 78,51786876,51786876,52921821,52921821,199607,58058659,16728 85 | 79,52054989,52054989,53064008,53064008,199608,59802408,16652 86 | 80,52225717,52225717,53256875,53256875,199609,49758328,17779 87 | 81,52482714,52482714,53375260,53375260,199610,53679750,16887 88 | 82,52495522,52495522,53531432,53531432,199611,48464209,16271 89 | 83,52830768,52830768,53718075,53718075,199612,53181172,18064 90 | 84,53122928,53122928,53956177,53956177,199701,49228750,18086 91 | 85,53124776,53124776,54183198,54183198,199702,47152265,17138 92 | 86,53312604,53312604,54251676,54251676,199703,58163010,17154 93 | 87,53442121,53442121,54425804,54425804,199704,53944329,17574 94 | 88,53596997,53596997,54564010,54564010,199705,55635847,16396 95 | 89,53770125,53770125,54750796,54750796,199706,58172771,18138 96 | 90,54028053,54028053,54745973,54745973,199707,61153800,16689 97 | 91,54203515,54203515,54771010,54771010,199708,61907945,16363 98 | 92,54370404,54370404,54908208,54908208,199709,51761004,17656 99 | 93,54482668,54482668,55000367,55000367,199710,55026915,16720 100 | 94,54737695,54737695,55222899,55222899,199711,51524528,16040 101 | 95,54789353,54789353,55420876,55420876,199712,53801076,18448 102 | 96,54811410,54811410,55697702,55697702,199801,49493435,17996 103 | 97,54876659,54876659,55878055,55878055,199802,47935244,16877 104 | 98,54874274,54874274,55840345,55840345,199803,58134392,16651 105 | 99,55118223,55118223,55990799,55990799,199804,56871713,17928 106 | 100,55297494,55297494,56136951,56136951,199805,57787100,16692 107 | 101,55467977,55467977,56315390,56315390,199806,60218576,17446 108 | 102,55779409,55779409,56396205,56396205,199807,64890982,16823 109 | 103,55846691,55846691,56512034,56512034,199808,62715323,16609 110 | 104,55908894,55908894,56811722,56811722,199809,52507440,17306 111 | 105,56072363,56072363,56993780,56993780,199810,56988546,17240 112 | 106,56270700,56270700,57128473,57128473,199811,53904572,16124 113 | 107,56395730,56395730,57308239,57308239,199812,55301435,18289 114 | 108,56520984,56520984,57523550,57523550,199901,50996487,18631 115 | 109,56659598,56659598,57686005,57686005,199902,49598613,17049 116 | 110,56907107,56907107,57815131,57815131,199903,61104493,17153 117 | 111,57063908,57063908,58126457,58126457,199904,58753327,18089 118 | 112,57167204,57167204,58412729,58412729,199905,59026650,17157 119 | 113,57366320,57366320,58617138,58617138,199906,62607968,18250 120 | 114,57513993,57513993,58639923,58639923,199907,66663065,17671 121 | 115,57730172,57730172,58837855,58837855,199908,65309471,16699 122 | 116,57977375,57977375,59275402,59275402,199909,55473871,17983 123 | 117,58263805,58263805,59541300,59541300,199910,60425711,17018 124 | 118,58610695,58610695,59907855,59907855,199911,58067248,16463 125 | 119,58681946,58681946,60377120,60377120,199912,56156443,18168 126 | 120,58744746,58744746,60753680,60753680,200001,51750091,18212 127 | 121,59077344,59077344,61002593,61002593,200002,53589785,17577 128 | 122,59397660,59397660,61141116,61141116,200003,64948291,17795 129 | 123,59668076,59668076,61366043,61366043,200004,61998314,19242 130 | 124,60111659,60111659,61504350,61504350,200005,64349644,19536 131 | 125,60544963,60544963,61645701,61645701,200006,67807620,19991 132 | 126,60810754,60810754,61821736,61821736,200007,69852555,18994 133 | 127,61075320,61075320,61930704,61930704,200008,68484270,19499 134 | 128,61294821,61294821,62025437,62025437,200009,58107878,19942 135 | 129,61438810,61438810,62017616,62017616,200010,62153577,18558 136 | 130,61617662,61617662,61974840,61974840,200011,60213479,18206 137 | 131,61766609,61766609,61872163,61872163,200012,57943798,20018 138 | 132,62046461,62046461,61819154,61819154,200101,55108316,20298 139 | 133,61990310,61990310,61870017,61870017,200102,52915977,19937 140 | 134,62000289,62000289,60929770,60929770,200103,65068044,20257 141 | 135,62031544,62031544,59601499,59601499,200104,62373365,19727 142 | 136,61887600,61887600,58506549,58506549,200105,62622321,18470 143 | 137,61753092,61753092,57674320,57674320,200106,66193520,21041 144 | 138,61726143,61726143,57015399,57015399,200107,69529176,20477 145 | 139,61863568,61863568,56459108,56459108,200108,70133361,20834 146 | 140,60248787,60248787,56097314,56097314,200109,38730506,20999 147 | 141,59048207,59048207,55519741,55519741,200110,47746624,17723 148 | 142,58051273,58051273,55010191,55010191,200111,48250267,16975 149 | 143,57374035,57374035,54587339,54587339,200112,49816945,18185 150 | 144,56768698,56768698,54123188,54123188,200201,47844272,31941 151 | 145,56280332,56280332,53593024,53593024,200202,47055580,32394 152 | 146,55792201,55792201,53552829,53552829,200203,59210469,34265 153 | 147,55182685,55182685,54527051,54527051,200204,55059178,35312 154 | 148,54737812,54737812,55190061,55190061,200205,57283840,36241 155 | 149,54260234,54260234,55910201,55910201,200206,60462592,37271 156 | 150,53738121,53738121,56526202,56526202,200207,63263816,17767 157 | 151,53181204,53181204,56864526,56864526,200208,63450360,17477 158 | 152,54111222,54111222,57159482,57159482,200209,49890724,18411 159 | 153,54975149,54975149,57226627,57226627,200210,58113746,24583 160 | 154,55483569,55483569,57364193,57364193,200211,54351302,23536 161 | 155,56354382,56354382,57582772,57582772,200212,60266707,25969 162 | 156,56817334,56817334,57955948,57955948,200301,53399694,25399 163 | 157,57078297,57078297,58297034,58297034,200302,50187136,25458 164 | 158,57186144,57186144,58475518,58475518,200303,60504638,24423 165 | 159,57297419,57297419,58808744,58808744,200304,56394469,25751 166 | 160,57417974,57417974,58967907,58967907,200305,58730501,24230 167 | 161,57660026,57660026,58640274,58640274,200306,63367220,25940 168 | 162,58092206,58092206,57770175,57770175,200307,68449976,27070 169 | 163,58364686,58364686,57181394,57181394,200308,66720119,27741 170 | 164,58717101,58717101,56944352,,200309,54119709,28160 171 | 165,58893093,58893093,56778227,,200310,60225641,27978 172 | 166,59109745,59109745,56711010,,200311,56951134,26728 173 | 167,58243023,58243023,56237125,,200312,49866045,22590 174 | 168,57478360,57478360,54998691,,200401,44223734,23049 175 | 169,57074710,57074710,53064237,,200402,45343339,20952 176 | ;;;; 177 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_employees.sas: -------------------------------------------------------------------------------- 1 | data WORK.EMPLOYEES(rename=(start2=Start)); 2 | infile datalines dsd truncover; 3 | input EmpNo:4. FirstName:$12. Department:$30. Gender:$1. Start2:YYMMDD10. End:YYMMDD10. Status:BEST12. TechKnowHow:$3. Duration:32. StartPeriod:$14. Resigned:32.; 4 | format EmpNo:4. FirstName:$12. Department:$30. Gender:$1. Start2:YYMMDD10. End:YYMMDD10. Status:BEST12. TechKnowHow:$3. Duration:32. StartPeriod:$14. Resigned:32.; 5 | datalines4; 6 | 1001,Don,MARKETING,M,2004-01-01,2012-02-29,0,NO,98,1: 2004 - 2008,1 7 | 1002,Hugh,SALES_REP,M,2005-01-01,2011-02-28,0,NO,74,1: 2004 - 2008,1 8 | 1003,Jim,TECH_SUPPORT,M,2006-05-01,,1,YES,128,1: 2004 - 2008,0 9 | 1004,Art,TECH_SUPPORT,M,2006-10-01,2011-11-30,0,YES,62,1: 2004 - 2008,1 10 | 1005,Viktor,SALES_ENGINEER,M,2006-10-01,2010-12-31,0,YES,51,1: 2004 - 2008,1 11 | 1006,Petra,ADMINSTRATION,F,2007-03-01,2010-11-30,0,NO,45,1: 2004 - 2008,1 12 | 1007,Jana,ADMINSTRATION,F,2007-10-01,2011-12-31,0,NO,51,1: 2004 - 2008,1 13 | 1008,Peter,SALES_REP,M,2007-11-01,2012-01-31,0,NO,51,1: 2004 - 2008,1 14 | 1009,Susan,ADMINSTRATION,F,2007-12-01,2012-07-31,0,NO,56,1: 2004 - 2008,1 15 | 1010,Paul,TECH_SUPPORT,M,2007-12-01,,1,YES,109,1: 2004 - 2008,0 16 | 1011,Carlos,TECH_SUPPORT,M,2008-02-01,2010-09-30,0,NO,32,1: 2004 - 2008,1 17 | 1012,Marius,MARKETING,M,2008-04-01,2015-11-30,0,NO,92,1: 2004 - 2008,1 18 | 1013,Thomas,SALES_REP,M,2008-06-01,2009-08-31,0,NO,15,1: 2004 - 2008,1 19 | 1014,Bert,SALES_REP,M,2008-06-01,2010-04-30,0,NO,23,1: 2004 - 2008,1 20 | 1015,Robert,TECH_SUPPORT,M,2008-07-01,2012-01-31,0,YES,43,1: 2004 - 2008,1 21 | 1016,Dominique,TECH_SUPPORT,M,2008-09-01,2010-10-31,0,YES,26,1: 2004 - 2008,1 22 | 1017,Patricia,TECH_SUPPORT,F,2008-09-01,2011-09-30,0,YES,37,1: 2004 - 2008,1 23 | 1018,Karen,ADMINSTRATION,F,2008-09-01,2014-08-31,0,NO,72,1: 2004 - 2008,1 24 | 1019,Rainer,SALES_ENGINEER,M,2009-01-01,2011-03-31,0,YES,27,2: 2009 - 2013,1 25 | 1020,John,SALES_ENGINEER,M,2009-04-01,2009-09-30,0,YES,6,2: 2009 - 2013,1 26 | 1021,Mary,MARKETING,F,2009-07-01,2012-07-31,0,NO,37,2: 2009 - 2013,1 27 | 1022,Frank,SALES_REP,M,2009-07-01,2010-05-31,0,NO,11,2: 2009 - 2013,1 28 | 1023,Alan,SALES_ENGINEER,M,2009-07-01,,1,YES,90,2: 2009 - 2013,0 29 | 1024,Frencesca,ADMINSTRATION,F,2009-08-01,2012-01-31,0,NO,30,2: 2009 - 2013,1 30 | 1025,Karl,SALES_ENGINEER,M,2009-08-01,2013-11-30,0,YES,52,2: 2009 - 2013,1 31 | 1026,Hana,ADMINSTRATION,F,2009-08-01,2010-03-31,0,NO,8,2: 2009 - 2013,1 32 | 1027,Brian,SALES_REP,M,2009-11-01,2010-10-31,0,NO,12,2: 2009 - 2013,1 33 | 1028,Pawel,SALES_REP,M,2009-11-01,2012-03-31,0,NO,29,2: 2009 - 2013,1 34 | 1029,Alessandro,TECH_SUPPORT,M,2010-02-01,,1,YES,83,2: 2009 - 2013,0 35 | 1030,Vincenz,SALES_ENGINEER,M,2010-02-01,2012-06-30,0,YES,29,2: 2009 - 2013,1 36 | 1031,Lisa,TECH_SUPPORT,F,2010-03-01,,1,YES,82,2: 2009 - 2013,0 37 | 1032,Stephen,TECH_SUPPORT,M,2010-06-01,2011-09-30,0,NO,16,2: 2009 - 2013,1 38 | 1033,Pawel,TECH_SUPPORT,M,2010-06-01,2013-04-30,0,YES,35,2: 2009 - 2013,1 39 | 1034,Oscar,TECH_SUPPORT,M,2010-07-01,2011-10-31,0,YES,16,2: 2009 - 2013,1 40 | 1035,Sara,ADMINSTRATION,F,2010-10-01,2014-01-31,0,NO,40,2: 2009 - 2013,1 41 | 1036,Alex,TECH_SUPPORT,M,2010-10-01,2012-11-30,0,NO,26,2: 2009 - 2013,1 42 | 1037,Rudolph,ADMINSTRATION,M,2010-11-01,,1,NO,74,2: 2009 - 2013,0 43 | 1038,Larry,MARKETING,M,2010-11-01,2015-08-31,0,NO,58,2: 2009 - 2013,1 44 | 1039,Ralf,TECH_SUPPORT,M,2010-12-01,2013-02-28,0,YES,27,2: 2009 - 2013,1 45 | 1040,Michael,TECH_SUPPORT,M,2010-12-01,2014-04-30,0,NO,41,2: 2009 - 2013,1 46 | 1041,Matthew,SALES_REP,M,2010-12-01,2012-01-31,0,NO,14,2: 2009 - 2013,1 47 | 1042,Carl,TECH_SUPPORT,M,2011-01-01,2015-04-30,0,NO,52,2: 2009 - 2013,1 48 | 1043,Martina,SALES_REP,F,2011-01-01,2011-10-31,0,NO,10,2: 2009 - 2013,1 49 | 1044,Felix,TECH_SUPPORT,M,2011-02-01,2011-10-31,0,NO,9,2: 2009 - 2013,1 50 | 1045,Malcolm,ADMINSTRATION,M,2011-03-01,,1,NO,70,2: 2009 - 2013,0 51 | 1046,Martin,SALES_REP,M,2011-04-01,2011-04-30,0,NO,1,2: 2009 - 2013,1 52 | 1047,Richard,SALES_REP,M,2011-06-01,2011-06-30,0,NO,1,2: 2009 - 2013,1 53 | 1048,Kim,SALES_REP,F,2011-06-01,2012-06-30,0,NO,13,2: 2009 - 2013,1 54 | 1049,Charles,SALES_REP,M,2011-06-01,2013-11-30,0,NO,30,2: 2009 - 2013,1 55 | 1050,Elias,SALES_REP,M,2011-07-01,2013-07-31,0,NO,25,2: 2009 - 2013,1 56 | 1051,Daniel,TECH_SUPPORT,M,2011-08-01,2014-08-31,0,YES,37,2: 2009 - 2013,1 57 | 1052,Iwona,SALES_REP,F,2012-01-01,2013-09-30,0,NO,21,2: 2009 - 2013,1 58 | 1053,Dave,TECH_SUPPORT,M,2012-02-01,2012-07-31,0,YES,6,2: 2009 - 2013,1 59 | 1054,Helena,TECH_SUPPORT,F,2012-02-01,,1,YES,59,2: 2009 - 2013,0 60 | 1055,Eugene,SALES_ENGINEER,M,2012-02-01,,1,YES,59,2: 2009 - 2013,0 61 | 1056,Bob,MARKETING,M,2012-04-01,,1,NO,57,2: 2009 - 2013,0 62 | 1057,Didier,SALES_REP,M,2012-04-01,2015-12-31,0,NO,45,2: 2009 - 2013,1 63 | 1058,Michele,ADMINSTRATION,F,2012-06-01,,1,NO,55,2: 2009 - 2013,0 64 | 1059,Verena,MARKETING,F,2012-07-01,,1,NO,54,2: 2009 - 2013,0 65 | 1060,George,SALES_ENGINEER,M,2012-08-01,2015-03-31,0,YES,32,2: 2009 - 2013,1 66 | 1061,Alice,ADMINSTRATION,F,2012-08-01,,1,NO,53,2: 2009 - 2013,0 67 | 1062,Ernest,SALES_REP,M,2012-11-01,2015-03-31,0,NO,29,2: 2009 - 2013,1 68 | 1063,Olaf,SALES_REP,M,2013-01-01,,1,NO,48,2: 2009 - 2013,0 69 | 1064,Joe,SALES_REP,M,2014-01-01,2015-03-31,0,NO,15,3: 2014-2016,1 70 | 1065,Nick,SALES_REP,M,2014-01-01,2016-12-31,0,NO,36,3: 2014-2016,1 71 | 1066,Mark,SALES_ENGINEER,M,2014-01-01,,1,YES,36,3: 2014-2016,0 72 | 1067,Joseph,TECH_SUPPORT,M,2014-03-01,,1,YES,34,3: 2014-2016,0 73 | 1068,Timon,TECH_SUPPORT,M,2014-05-01,,1,YES,32,3: 2014-2016,0 74 | 1069,Lucia,ADMINSTRATION,F,2014-09-01,2016-01-31,0,NO,17,3: 2014-2016,1 75 | 1070,Robin,SALES_REP,M,2015-01-01,2016-02-29,0,NO,14,3: 2014-2016,1 76 | 1071,Conrad,SALES_REP,M,2015-03-01,,1,NO,22,3: 2014-2016,0 77 | 1072,Bettina,TECH_SUPPORT,F,2015-05-01,,1,YES,20,3: 2014-2016,0 78 | 1073,Ingrid,ADMINSTRATION,F,2015-05-01,,1,NO,20,3: 2014-2016,0 79 | 1074,Manuel,TECH_SUPPORT,M,2015-06-01,,1,NO,19,3: 2014-2016,0 80 | 1075,Olivier,TECH_SUPPORT,M,2015-07-01,,1,YES,18,3: 2014-2016,0 81 | 1076,Alf,SALES_REP,M,2015-09-01,2016-02-29,0,NO,6,3: 2014-2016,1 82 | 1077,Nikita,MARKETING,F,2015-11-01,,1,NO,14,3: 2014-2016,0 83 | 1078,Jack,SALES_REP,M,2016-01-01,,1,NO,12,3: 2014-2016,0 84 | 1079,Francesca,ADMINSTRATION,F,2016-03-01,,1,NO,10,3: 2014-2016,0 85 | 1080,Nina,TECH_SUPPORT,F,2016-03-01,,1,YES,10,3: 2014-2016,0 86 | 1081,Anja,MARKETING,F,2016-03-01,,1,NO,10,3: 2014-2016,0 87 | 1082,Lucas,SALES_ENGINEER,M,2016-03-01,,1,YES,10,3: 2014-2016,0 88 | 1083,Kilian,SALES_REP,M,2016-06-01,,1,NO,7,3: 2014-2016,0 89 | 1084,Jean,TECH_SUPPORT,M,2016-07-01,,1,NO,6,3: 2014-2016,0 90 | 1085,Joshua,TECH_SUPPORT,M,2016-07-01,,1,YES,6,3: 2014-2016,0 91 | 1086,Brady,SALES_ENGINEER,M,2016-07-01,,1,YES,6,3: 2014-2016,0 92 | 1087,Serge,SALES_REP,M,2016-07-01,,1,NO,6,3: 2014-2016,0 93 | 1088,Simone,TECH_SUPPORT,F,2016-09-01,,1,YES,4,3: 2014-2016,0 94 | 1089,Bruce,SALES_REP,M,2016-09-01,,1,NO,4,3: 2014-2016,0 95 | 1090,Philip,TECH_SUPPORT,M,2016-11-01,,1,YES,2,3: 2014-2016,0 96 | 1091,Guido,SALES_REP,M,2016-11-01,,1,NO,2,3: 2014-2016,0 97 | ;;;; 98 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_flights_911.sas: -------------------------------------------------------------------------------- 1 | data WORK.FLIGHTS_911; 2 | infile datalines dsd truncover; 3 | input Date:YYMMN6. Passengers:8.1 Nflights:8.; 4 | format Date:YYMMN6. Passengers:8.1 Nflights:8.; 5 | datalines4; 6 | 199001,37208190,18592 7 | 199002,36078394,18168 8 | 199003,44154535,18218 9 | 199004,41355578,17334 10 | 199005,41234923,17375 11 | 199006,44190605,18232 12 | 199007,46036310,17770 13 | 199008,48866148,17361 14 | 199009,38989264,19074 15 | 199010,41247525,17671 16 | 199011,39346113,16902 17 | 199012,39342008,19386 18 | 199101,36716670,19046 19 | 199102,33688621,16961 20 | 199103,39477477,17005 21 | 199104,39878137,17698 22 | 199105,41018839,16761 23 | 199106,43166181,17259 24 | 199107,45727485,16804 25 | 199108,47802583,16682 26 | 199109,38628284,17811 27 | 199110,41170282,17301 28 | 199111,37451867,16594 29 | 199112,41159310,18696 30 | 199201,36719242,18403 31 | 199202,35757887,17089 32 | 199203,41861145,17413 33 | 199204,39651142,17501 34 | 199205,41800746,16566 35 | 199206,47431207,17919 36 | 199207,51806387,17825 37 | 199208,53163782,17614 38 | 199209,42510606,19318 39 | 199210,42253840,17397 40 | 199211,39566414,16715 41 | 199212,40849861,19504 42 | 199301,38529065,18748 43 | 199302,36539132,17391 44 | 199303,43775242,17854 45 | 199304,43125070,18869 46 | 199305,44300992,16850 47 | 199306,46334965,18324 48 | 199307,49482654,16981 49 | 199308,50934128,16806 50 | 199309,43364388,19233 51 | 199310,45930858,17171 52 | 199311,42769377,17237 53 | 199312,43872406,19672 54 | 199401,40665800,19146 55 | 199402,39264392,18101 56 | 199403,48963885,18528 57 | 199404,46124425,18536 58 | 199405,47883199,16936 59 | 199406,50554571,17764 60 | 199407,54026538,16987 61 | 199408,54735918,16366 62 | 199409,46918744,18065 63 | 199410,49220347,16928 64 | 199411,46742038,16441 65 | 199412,47700305,18377 66 | 199501,44687190,18091 67 | 199502,41896823,17528 68 | 199503,50985658,16913 69 | 199504,49212746,16936 70 | 199505,49824307,15917 71 | 199506,52881186,17495 72 | 199507,54957670,16394 73 | 199508,56585046,16265 74 | 199509,47709592,17431 75 | 199510,50595784,16820 76 | 199511,48310520,16000 77 | 199512,49158213,17991 78 | 199601,45722827,17737 79 | 199602,47130093,17476 80 | 199603,55909079,16990 81 | 199604,52390127,17519 82 | 199605,53777332,16287 83 | 199606,56095234,17996 84 | 199607,58058659,16728 85 | 199608,59802408,16652 86 | 199609,49758328,17779 87 | 199610,53679750,16887 88 | 199611,48464209,16271 89 | 199612,53181172,18064 90 | 199701,49228750,18086 91 | 199702,47152265,17138 92 | 199703,58163010,17154 93 | 199704,53944329,17574 94 | 199705,55635847,16396 95 | 199706,58172771,18138 96 | 199707,61153800,16689 97 | 199708,61907945,16363 98 | 199709,51761004,17656 99 | 199710,55026915,16720 100 | 199711,51524528,16040 101 | 199712,53801076,18448 102 | 199801,49493435,17996 103 | 199802,47935244,16877 104 | 199803,58134392,16651 105 | 199804,56871713,17928 106 | 199805,57787100,16692 107 | 199806,60218576,17446 108 | 199807,64890982,16823 109 | 199808,62715323,16609 110 | 199809,52507440,17306 111 | 199810,56988546,17240 112 | 199811,53904572,16124 113 | 199812,55301435,18289 114 | 199901,50996487,18631 115 | 199902,49598613,17049 116 | 199903,61104493,17153 117 | 199904,58753327,18089 118 | 199905,59026650,17157 119 | 199906,62607968,18250 120 | 199907,66663065,17671 121 | 199908,65309471,16699 122 | 199909,55473871,17983 123 | 199910,60425711,17018 124 | 199911,58067248,16463 125 | 199912,56156443,18168 126 | 200001,51750091,18212 127 | 200002,53589785,17577 128 | 200003,64948291,17795 129 | 200004,61998314,19242 130 | 200005,64349644,19536 131 | 200006,67807620,19991 132 | 200007,69852555,18994 133 | 200008,68484270,19499 134 | 200009,58107878,19942 135 | 200010,62153577,18558 136 | 200011,60213479,18206 137 | 200012,57943798,20018 138 | 200101,55108316,20298 139 | 200102,52915977,19937 140 | 200103,65068044,20257 141 | 200104,62373365,19727 142 | 200105,62622321,18470 143 | 200106,66193520,21041 144 | 200107,69529176,20477 145 | 200108,70133361,20834 146 | 200109,38730506,20999 147 | 200110,47746624,17723 148 | 200111,48250267,16975 149 | 200112,49816945,18185 150 | 200201,47844272,31941 151 | 200202,47055580,32394 152 | 200203,59210469,34265 153 | 200204,55059178,35312 154 | 200205,57283840,36241 155 | 200206,60462592,37271 156 | 200207,63263816,17767 157 | 200208,63450360,17477 158 | 200209,49890724,18411 159 | 200210,58113746,24583 160 | 200211,54351302,23536 161 | 200212,60266707,25969 162 | 200301,53399694,25399 163 | 200302,50187136,25458 164 | 200303,60504638,24423 165 | 200304,56394469,25751 166 | 200305,58730501,24230 167 | 200306,63367220,25940 168 | 200307,68449976,27070 169 | 200308,66720119,27741 170 | 200309,54119709,28160 171 | 200310,60225641,27978 172 | 200311,56951134,26728 173 | 200312,49866045,22590 174 | 200401,44223734,23049 175 | 200402,45343339,20952 176 | ;;;; 177 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_patients.sas: -------------------------------------------------------------------------------- 1 | data WORK.PATIENTS; 2 | infile datalines dsd truncover; 3 | input PNR:8. Age:8. Sex:8. Weight:8. Breslow:8.2 LDL:8. randdate:YYMMDD10. startdate:YYMMDD10. TRE_CODE:$1. rec_date:YYMMDD10. dth_date:YYMMDD10. Cnt_AES_Severe:32. Cnt_AES:32.; 4 | format PNR:8. Age:8. Sex:8. Weight:8. Breslow:8.2 LDL:8. randdate:YYMMDD10. startdate:YYMMDD10. TRE_CODE:$1. rec_date:YYMMDD10. dth_date:YYMMDD10. Cnt_AES_Severe:32. Cnt_AES:32.; 5 | datalines4; 6 | 10003,68,0,88,2.18,198,2012-12-12,2012-10-27,B,2013-11-16,,0,2 7 | 10005,72,1,110,1.68,155,2012-05-30,2012-07-10,A,,,0,12 8 | 10006,50,0,99,2.54,118,2014-07-22,2014-09-29,B,,,0,2 9 | 10007,48,0,77,3.02,153,2013-03-02,2013-03-05,B,,,1,10 10 | 10012,42,0,121,4.10,176,2012-03-06,2012-05-16,A,2012-11-24,2013-10-20,, 11 | 10013,66,0,92,1.90,165,2012-11-14,2012-11-30,B,2015-07-03,2015-09-18,0,16 12 | 10014,66,0,66,5.66,151,2015-06-28,2015-07-25,A,2016-12-14,,0,5 13 | 10015,52,1,97,4.10,137,2012-04-05,2012-03-18,A,,,1,3 14 | 10016,68,0,80,2.46,110,2012-05-29,2012-07-09,A,,,0,8 15 | 10017,57,0,82,1.68,68,2014-12-05,2014-11-17,B,2017-02-19,,0,4 16 | 10018,55,0,108,1.82,103,2012-04-19,2012-01-24,A,,,0,5 17 | 10019,66,0,75,4.10,245,2013-05-12,2013-04-21,B,,,0,6 18 | 10020,69,1,91,5.06,129,2012-12-13,2012-11-17,B,,,0,5 19 | 10021,53,0,94,1.54,,2012-04-20,2012-04-30,A,,,3,7 20 | 10022,63,1,102,2.26,116,2012-08-28,2012-09-10,B,,,0,5 21 | 10023,63,0,80,1.78,,2014-11-20,2014-12-01,A,,,0,9 22 | 10024,72,0,85,1.64,130,2014-09-01,2014-07-23,A,,,0,3 23 | 10026,70,1,67,7.28,156,2015-05-14,2015-03-22,B,2017-01-25,,0,5 24 | 10028,51,0,72,2.96,176,2015-06-09,2015-03-17,B,,,0,5 25 | 10029,67,0,79,9.60,139,2013-05-03,2013-04-11,A,2013-12-06,,, 26 | 10030,66,0,74,2.86,169,2013-01-29,2013-03-06,A,2015-02-18,2017-02-12,0,9 27 | 10032,61,0,87,5.64,155,2011-11-16,2011-10-26,B,2013-03-03,2014-01-18,1,2 28 | 10033,40,1,66,1.94,129,2015-06-19,2015-07-26,B,,,0,4 29 | 10034,65,1,85,2.62,182,2013-07-06,2013-08-17,A,,,1,5 30 | 10035,32,0,71,2.48,109,2015-07-06,2015-06-02,A,,,0,3 31 | 10036,51,1,86,3.48,,2012-07-16,2012-06-28,B,2012-08-04,2013-06-24,0,4 32 | 10037,39,0,83,2.20,179,2012-05-08,2012-03-09,B,,,0,7 33 | 10038,25,0,108,5.06,99,2012-11-08,2013-02-18,A,2013-12-22,2014-10-20,0,3 34 | 10040,45,0,95,1.58,128,2012-03-28,2012-01-02,B,,,1,10 35 | 10044,73,0,80,1.58,129,2013-05-28,2013-04-10,B,,,0,4 36 | 10045,53,0,75,2.86,105,2012-11-15,2013-01-29,A,,,0,3 37 | 10046,47,0,93,6.78,154,2012-09-17,2012-11-01,A,2013-07-11,,, 38 | 10048,64,0,97,4.22,,2011-07-09,2011-06-24,B,2013-04-21,2013-07-07,1,2 39 | 10049,51,1,99,3.62,,2013-03-08,2013-04-14,B,,,0,6 40 | 10051,48,0,98,2.10,129,2012-10-21,2012-11-28,A,,,1,12 41 | 10052,25,0,89,2.46,227,2013-11-26,2014-01-08,B,2016-07-27,,0,1 42 | 10053,47,0,98,1.54,143,2011-10-29,2011-09-08,B,,,0,12 43 | 10054,60,0,79,1.88,124,2014-11-09,2014-12-26,B,,,0,2 44 | 10055,41,0,87,1.78,,2014-01-20,2014-01-06,A,,,0,7 45 | 10057,60,0,95,8.66,,2014-11-15,2014-12-27,A,2017-01-23,2017-07-19,0,2 46 | 10058,47,0,100,1.54,109,2012-06-15,2012-05-07,A,2015-11-25,,0,2 47 | 10060,67,1,81,1.88,,2011-09-06,2011-10-18,A,2015-09-14,2018-07-02,0,1 48 | 10061,70,0,75,4.76,125,2013-04-17,2013-02-20,A,2013-10-12,,0,2 49 | 10062,76,0,95,5.64,187,2014-03-23,2014-03-08,A,,,2,5 50 | 10063,60,0,87,1.68,,2014-10-20,2014-12-24,A,,2015-03-05,1,1 51 | 10064,25,0,82,1.78,115,2012-06-30,2012-07-22,B,,,0,2 52 | 10065,62,1,59,,97,2015-06-11,2015-08-14,A,,,0,7 53 | 10066,50,1,76,2.00,86,2013-05-23,2013-05-27,B,,,0,5 54 | 10068,53,1,75,2.48,,2014-12-23,2015-03-25,B,2015-04-13,2017-08-22,0,2 55 | 10070,56,1,78,3.14,184,2012-02-09,2011-12-25,B,,,0,6 56 | 10071,66,0,96,4.52,198,2014-05-31,2014-09-14,A,,,, 57 | 10073,51,1,96,4.60,177,2014-05-21,2014-02-05,B,,,1,2 58 | 10074,37,0,75,1.52,73,2015-02-17,2015-03-20,B,,,2,18 59 | 10075,32,0,75,2.82,89,2014-02-19,2014-03-09,B,2016-12-20,,0,2 60 | 10076,57,1,66,,,2015-08-02,2015-10-13,A,,,0,12 61 | 10078,76,0,81,,98,2014-09-19,2014-09-22,B,,,0,8 62 | 10081,75,1,84,2.02,180,2014-03-17,2014-01-14,A,,,, 63 | 10082,51,0,94,2.42,114,2011-08-03,2011-10-24,B,,,0,8 64 | 10083,56,1,77,3.90,148,2013-03-24,2013-03-29,B,,,0,2 65 | 10084,60,0,82,1.80,,2012-04-26,2012-04-18,B,,,0,15 66 | 10085,51,1,90,1.50,210,2013-04-11,2013-03-19,A,,,, 67 | 10088,48,0,79,6.80,122,2012-09-05,2012-06-24,A,2012-11-16,2014-03-15,1,3 68 | 10089,27,0,84,1.62,166,2011-08-21,2011-08-11,B,,,0,11 69 | 10090,61,1,79,2.30,138,2012-04-07,2012-04-19,A,,,0,10 70 | 10091,51,0,68,,126,2015-09-15,2015-08-02,A,2016-03-05,,0,2 71 | 10092,37,0,90,6.82,183,2015-01-10,2015-01-13,A,,,4,6 72 | 10094,61,0,89,4.02,,2015-06-06,2015-06-08,B,2016-01-06,2017-01-13,0,2 73 | 10095,59,0,102,1.98,63,2013-03-04,2013-01-08,B,2015-01-14,2015-09-20,1,5 74 | 10096,64,0,90,2.12,93,2013-03-21,2013-04-27,B,,,1,8 75 | 10097,46,0,105,2.34,,2012-06-06,2012-05-17,A,2013-09-21,,0,4 76 | 10098,58,0,73,2.92,,2011-12-10,2012-01-27,A,2012-03-26,,, 77 | 10100,65,0,83,6.80,,2014-05-25,2014-03-26,A,2014-12-10,2016-02-23,0,1 78 | 10101,39,0,92,3.28,134,2014-07-06,2014-06-20,A,2014-09-14,,0,2 79 | 10102,69,0,76,2.06,157,2014-07-12,2014-08-02,A,,,0,2 80 | 10103,65,0,82,2.40,173,2013-10-05,2013-09-28,A,,,1,3 81 | 10104,39,0,81,2.46,130,2011-08-08,2011-08-03,A,,,, 82 | 10105,43,0,90,1.74,183,2012-04-20,2012-06-02,A,,,0,1 83 | 10106,71,0,97,4.26,187,2012-11-13,2012-09-03,B,,2014-02-09,1,9 84 | 10107,55,0,81,5.72,170,2015-03-10,2015-03-12,B,2015-07-28,,, 85 | 10108,70,1,86,,,2013-06-26,2013-05-02,B,,,0,6 86 | 10109,72,0,95,3.34,100,2012-04-01,2012-05-13,B,,,1,2 87 | 10110,64,1,76,2.26,212,2013-07-30,2013-06-20,B,2017-10-14,,3,10 88 | 10111,55,0,81,1.60,150,2013-08-13,2013-06-13,B,2015-08-31,2016-08-27,2,7 89 | 10113,47,0,82,1.88,128,2012-02-07,2012-01-23,B,2016-08-20,,0,1 90 | 10114,37,0,83,1.84,123,2011-10-16,2011-11-11,A,,,0,5 91 | 10115,57,0,95,4.00,178,2013-04-24,2013-04-01,A,,,0,4 92 | 10116,72,0,83,1.46,183,2012-10-03,2012-12-07,B,,,0,8 93 | 10117,53,1,73,2.88,172,2013-04-27,2013-07-01,A,,,0,8 94 | 10118,46,0,87,2.98,153,2011-11-16,2011-11-27,B,,,4,11 95 | 10119,49,0,115,1.88,135,2011-12-16,2011-10-25,B,,,0,8 96 | 10120,19,0,73,,77,2015-09-23,2015-08-31,A,,,, 97 | 10121,69,0,90,2.18,,2015-11-01,2015-10-11,B,2016-06-15,,1,3 98 | 10122,30,0,83,,125,2015-08-07,2015-07-17,B,,,, 99 | 10123,58,0,75,1.70,61,2014-09-20,2014-09-05,B,,,0,4 100 | 10124,66,1,95,2.14,168,2015-05-14,2015-04-15,B,,,, 101 | 10125,62,1,125,2.36,,2015-04-18,2015-04-16,A,,,0,12 102 | 10128,47,0,81,1.78,,2015-01-08,2015-01-29,A,2015-01-18,2017-10-18,1,1 103 | 10129,57,0,95,2.62,117,2015-10-03,2015-10-15,A,,,, 104 | 10130,59,0,75,4.14,167,2014-11-08,2014-12-15,B,,,0,3 105 | 10131,66,0,83,1.94,152,2015-08-02,2015-06-17,A,,,0,2 106 | 10132,25,0,85,2.10,131,2015-03-21,2015-05-20,A,,,2,6 107 | 10133,40,0,100,5.12,132,2015-05-21,2015-04-08,B,,,1,11 108 | 10134,64,0,79,3.60,125,2015-06-10,2015-04-25,A,2016-04-02,,0,1 109 | 10135,51,0,97,1.74,,2014-12-15,2014-10-23,B,,,0,13 110 | 10137,56,1,79,1.90,128,2015-04-22,2015-02-09,A,,,4,7 111 | 10138,20,1,97,2.96,83,2014-09-10,2014-12-04,B,2015-08-11,,1,4 112 | 10139,55,0,68,,107,2015-10-07,2015-12-29,A,,,, 113 | 10140,68,0,87,1.62,,2015-02-26,2015-01-11,B,,,0,8 114 | 10144,60,0,99,1.54,,2014-12-02,2015-02-05,B,,,2,3 115 | 10145,41,0,78,,134,2015-11-01,2015-09-30,B,2016-03-16,2016-12-10,0,2 116 | 10146,65,1,85,3.26,188,2014-10-08,2014-08-26,B,,,0,5 117 | 10147,36,0,83,1.88,,2015-01-25,2014-11-30,B,,,0,9 118 | 10148,74,0,79,,,2015-10-11,2015-09-30,A,2016-08-19,,2,3 119 | 10149,62,0,73,1.94,,2015-08-10,2015-08-23,B,,,0,1 120 | 10150,73,1,71,1.76,,2015-10-31,2015-08-30,A,,,0,5 121 | 10151,65,1,91,1.58,97,2016-12-19,2016-12-18,A,,,0,9 122 | 10155,34,0,83,1.56,117,2016-10-13,2016-10-19,B,,,2,3 123 | 10156,70,0,79,3.26,,2016-08-04,2016-08-30,A,,,0,2 124 | 10158,36,1,94,1.54,,2016-09-15,2016-10-05,B,,,1,9 125 | 10159,60,0,117,4.10,,2017-02-12,2016-11-30,B,2017-06-12,,, 126 | 10161,44,0,82,1.52,204,2016-10-08,2016-11-06,A,,,0,1 127 | 10162,46,1,75,1.48,128,2016-10-08,2016-12-16,B,,,0,4 128 | 10163,49,0,84,1.56,,2017-01-04,2017-01-19,A,,,0,6 129 | 10164,70,1,81,1.88,,2017-01-05,2017-01-12,B,,,1,5 130 | 10165,61,0,80,3.60,,2016-11-01,2016-10-19,A,2017-07-01,,0,3 131 | 10166,37,0,77,1.78,,2016-08-23,2016-11-02,A,,,, 132 | 10167,73,0,106,4.90,150,2016-10-10,2016-10-17,B,,,0,2 133 | 10168,58,1,82,3.10,164,2016-11-29,2017-01-24,B,2018-06-20,,1,3 134 | 10169,55,0,88,,87,2017-02-10,2017-02-22,B,,,2,4 135 | 10170,56,0,100,9.50,173,2016-10-25,2016-12-06,A,2017-03-05,2018-03-23,1,3 136 | 10171,65,1,94,,117,2016-10-16,2016-07-31,A,,,3,8 137 | 10173,40,0,83,4.24,159,2016-02-09,2015-11-20,B,2016-04-07,,0,2 138 | 10174,46,0,87,4.82,89,2016-05-04,2016-05-18,B,,,, 139 | 10175,38,0,111,5.76,113,2016-11-10,2016-08-25,A,,,1,6 140 | 10176,64,0,94,3.92,,2016-09-03,2016-08-26,A,,,0,5 141 | 10177,35,0,85,1.78,92,2016-02-06,2016-03-06,A,,,0,2 142 | 10178,48,1,85,2.06,131,2015-11-29,2015-11-18,B,,,0,2 143 | 10179,59,0,89,2.48,161,2016-04-15,2016-06-09,A,,,1,11 144 | 10180,50,0,86,1.56,157,2016-07-18,2016-09-22,B,,,0,4 145 | 10181,62,0,82,2.94,,2016-02-10,2016-02-07,A,2016-11-11,2017-04-28,, 146 | 10182,56,0,92,,173,2016-03-02,2016-04-02,B,,,0,6 147 | 10184,40,0,114,2.24,74,2016-02-11,2016-02-06,A,,,0,2 148 | 10185,53,0,71,,184,2016-03-07,2016-04-20,B,,,0,2 149 | 10186,64,1,79,4.38,73,2016-09-05,2016-06-23,A,,,1,3 150 | 10187,70,0,109,1.78,81,2016-05-02,2016-04-13,B,,,0,9 151 | 10188,75,0,81,1.74,,2016-01-26,2015-12-10,B,,,0,9 152 | 10189,64,1,106,1.98,,2016-05-19,2016-06-03,A,,,0,6 153 | 10193,42,0,95,10.40,98,2016-08-10,2016-07-24,B,,,0,5 154 | 10194,48,1,87,1.46,,2016-01-02,2016-03-05,A,,,0,5 155 | 10195,64,0,115,4.48,145,2016-06-22,2016-07-26,A,2017-11-05,2017-10-03,0,1 156 | 10196,38,1,111,1.88,137,2016-03-17,2016-05-15,B,,,0,6 157 | 10197,27,1,73,,,2016-08-03,2016-08-08,A,2016-12-13,,0,1 158 | 10198,66,0,78,5.16,,2015-12-15,2016-03-13,B,,,, 159 | 10199,49,1,81,2.02,92,2016-09-26,2016-10-19,A,,,0,2 160 | 10200,49,1,131,2.40,,2016-08-07,2016-07-02,B,,,0,2 161 | 10201,31,1,75,1.50,135,2016-12-31,2016-10-25,B,,,0,6 162 | 10202,72,0,82,2.36,118,2017-05-08,2017-04-06,A,,,0,3 163 | 10203,52,1,70,,,2017-01-26,2016-12-01,B,,2018-03-30,0,3 164 | 10205,73,1,65,3.20,189,2013-03-29,2013-02-16,B,,,2,4 165 | 10206,46,1,48,3.06,168,2012-06-03,2012-06-16,A,2013-02-24,2013-10-18,0,2 166 | 10207,64,1,61,1.70,,2011-12-07,2011-09-14,B,,,0,15 167 | 10208,56,0,73,2.86,118,2012-07-22,2012-07-15,A,,,0,1 168 | 10209,69,1,63,3.30,,2011-10-31,2011-09-26,B,,2016-07-25,4,8 169 | 10210,59,0,69,4.84,110,2012-02-23,2012-03-27,A,2012-11-02,2015-01-02,1,2 170 | 10211,26,1,57,2.02,138,2013-03-24,2013-03-06,B,2014-11-22,2015-04-02,1,6 171 | 10213,76,1,62,2.98,183,2014-05-06,2014-07-26,A,2015-12-24,,0,5 172 | 10214,61,1,58,6.88,,2012-01-29,2011-12-28,B,2017-02-13,,0,6 173 | 10216,38,1,66,4.88,119,2013-02-09,2013-04-04,B,,,0,1 174 | 10218,55,1,61,6.28,143,2012-11-18,2012-10-01,A,2014-10-20,,0,4 175 | 10219,37,1,59,1.86,,2014-09-08,2014-08-06,A,,,2,4 176 | 10220,48,0,68,5.72,119,2012-08-01,2012-10-21,A,2015-04-21,2016-07-01,, 177 | 10221,43,1,58,4.40,111,2012-09-08,2012-08-16,A,2015-01-24,2015-03-28,0,1 178 | 10223,59,1,71,3.86,175,2013-01-07,2012-12-22,B,,,0,1 179 | 10224,49,1,64,1.92,121,2012-06-12,2012-08-15,A,,,3,8 180 | 10225,56,0,66,1.50,,2012-03-22,2012-01-11,A,2014-08-12,2014-10-02,0,4 181 | 10226,69,1,55,1.76,,2013-07-02,2013-06-20,A,,,, 182 | 10227,66,0,75,5.22,,2013-10-05,2013-11-29,B,,,0,6 183 | 10228,67,0,74,2.08,,2014-02-06,2014-03-30,A,,,1,7 184 | 10229,25,1,55,4.88,156,2013-06-26,2013-04-23,B,,,, 185 | 10232,29,1,72,4.28,54,2013-01-20,2013-03-04,A,2015-10-17,2016-02-11,15,14 186 | 10233,75,1,75,2.10,,2012-06-12,2012-03-11,B,,,0,9 187 | 10234,17,1,66,1.88,130,2012-07-19,2012-07-02,A,,,1,4 188 | 10235,54,1,72,7.90,1,2013-11-05,2013-08-30,A,,,1,7 189 | 10236,54,1,56,1.56,126,2013-07-22,2013-11-04,B,,,0,7 190 | 10237,70,1,66,3.98,,2011-12-05,2011-12-25,B,,,0,8 191 | 10238,26,1,57,2.62,67,2014-07-24,2014-07-11,B,,,0,5 192 | 10240,72,1,59,2.06,131,2012-07-24,2012-07-16,A,,,1,4 193 | 10241,33,1,68,1.98,157,2012-08-18,2012-08-24,A,,,2,5 194 | 10242,37,1,66,2.80,92,2012-10-05,2012-09-11,B,,,1,8 195 | 10243,41,1,63,4.04,123,2012-04-19,2012-07-15,A,,,0,6 196 | 10244,54,1,66,3.98,151,2011-10-02,2011-11-12,A,,,2,9 197 | 10245,74,1,67,2.24,97,2012-06-07,2012-06-23,B,,,1,9 198 | 10247,50,1,66,1.78,,2013-05-05,2013-02-27,A,2014-05-09,,0,3 199 | 10248,51,1,75,1.70,,2013-05-24,2013-03-27,B,,,0,2 200 | 10250,35,1,63,2.82,,2013-03-19,2013-06-17,A,,,0,5 201 | 10251,45,1,73,3.40,114,2013-03-03,2013-02-28,A,2016-03-11,,8,12 202 | 10252,69,0,72,1.88,114,2011-08-10,2011-10-24,B,2012-05-21,2016-09-05,0,2 203 | 10253,33,1,52,2.94,116,2012-06-01,2012-05-15,B,,,0,9 204 | 10254,61,0,61,,,2014-05-05,2014-07-09,B,,,, 205 | 10256,74,0,68,2.44,148,2014-02-12,2014-02-19,B,2015-05-13,,1,4 206 | 10257,60,1,57,3.46,,2014-08-20,2014-07-30,B,,,1,2 207 | 10258,50,1,60,2.00,89,2014-02-28,2014-03-29,B,,,4,8 208 | 10259,67,0,69,1.52,,2014-07-27,2014-07-21,A,2017-02-15,2018-02-07,, 209 | 10260,42,1,55,2.28,166,2014-08-04,2014-06-23,A,,,0,6 210 | 10261,28,1,51,2.16,86,2014-05-30,2014-04-25,B,,,0,1 211 | 10262,39,1,46,5.32,72,2013-11-04,2013-12-01,A,2017-01-14,,0,1 212 | 10264,42,0,70,1.76,73,2013-07-03,2013-06-12,B,2016-11-25,2016-11-25,2,3 213 | 10265,51,1,68,2.60,91,2011-10-11,2011-10-06,A,,,0,14 214 | 10266,49,1,73,,143,2014-06-27,2014-04-08,A,,,2,6 215 | 10267,47,1,62,3.00,,2011-10-25,2011-11-15,A,,,, 216 | 10268,26,1,73,1.80,,2011-11-08,2012-02-29,A,,,0,2 217 | 10271,51,1,63,1.88,154,2013-01-06,2013-01-23,B,2013-08-13,2014-05-22,0,3 218 | 10273,74,1,75,2.54,139,2012-06-16,2012-05-08,B,2013-03-09,,0,2 219 | 10274,75,1,61,3.38,145,2012-10-09,2012-10-02,B,2014-04-19,,0,4 220 | 10275,43,1,68,1.92,,2012-12-16,2012-12-19,A,,,0,9 221 | 10278,46,1,63,1.82,117,2014-06-19,2014-05-20,B,,,, 222 | 10279,38,1,73,1.52,147,2011-12-18,2011-12-14,B,,,0,9 223 | 10280,29,1,56,2.72,105,2012-10-28,2012-12-21,A,,,0,4 224 | 10282,50,1,62,3.50,167,2014-05-11,2014-03-25,B,,,3,9 225 | 10283,56,1,65,5.08,,2011-10-27,2011-09-19,A,,,1,4 226 | 10285,41,1,55,2.50,140,2015-03-04,2015-02-03,A,,,0,2 227 | 10286,61,1,49,2.94,,2014-10-23,2014-10-17,A,2015-02-06,2016-09-12,1,3 228 | 10287,22,1,66,4.14,168,2015-03-17,2015-03-19,B,,,0,1 229 | 10288,59,1,60,3.84,,2015-02-21,2015-03-25,A,,,0,6 230 | 10289,71,1,74,5.22,79,2014-10-14,2014-10-04,B,2014-11-14,2016-12-30,1,1 231 | 10290,68,1,61,2.10,,2015-11-09,2015-08-21,B,,,0,5 232 | 10291,63,1,55,1.52,,2014-10-20,2014-11-03,A,,,0,5 233 | 10292,45,1,60,1.92,,2014-10-25,2014-11-24,A,,,0,5 234 | 10293,70,1,57,3.54,,2014-09-23,2014-10-13,B,2015-04-07,2016-06-03,1,1 235 | 10295,71,1,68,3.28,,2014-10-09,2014-12-20,B,,,0,9 236 | 10296,60,0,68,3.00,158,2014-12-04,2014-12-30,B,,,0,3 237 | 10298,36,1,51,1.80,91,2014-11-20,2014-12-29,A,,,1,1 238 | 10299,40,1,52,2.44,161,2015-04-08,2015-02-18,A,2015-09-07,,, 239 | 10300,49,1,55,1.90,131,2014-10-28,2014-10-26,A,,,0,10 240 | 10301,50,1,59,1.54,,2015-02-19,2015-02-07,B,2016-06-28,,0,2 241 | 10302,62,0,69,2.90,147,2015-01-25,2015-05-07,A,,,0,5 242 | 10303,52,0,67,1.64,197,2015-02-13,2015-02-06,A,,,0,3 243 | 10305,55,1,68,1.88,113,2016-11-04,2016-09-15,A,,,1,7 244 | 10306,57,1,57,1.44,,2017-04-04,2017-02-22,A,,,1,7 245 | 10307,21,1,61,1.58,,2016-09-01,2016-07-17,B,,,0,8 246 | 10308,69,1,61,3.54,134,2017-01-06,2017-03-21,A,,,0,6 247 | 10309,37,0,70,4.22,,2017-03-01,2016-12-09,B,,,0,4 248 | 10310,50,1,50,1.54,,2016-07-26,2016-07-22,B,2017-05-12,,1,5 249 | 10311,67,0,74,,129,2017-04-20,2017-04-09,A,2017-07-21,,, 250 | 10313,46,1,61,9.10,131,2016-11-19,2017-01-28,A,,,0,1 251 | 10314,64,1,74,1.56,132,2016-06-05,2016-08-23,A,,,0,1 252 | 10315,39,1,51,3.14,133,2017-02-01,2017-02-27,A,,,0,2 253 | 10316,24,1,62,2.50,85,2016-05-23,2016-07-08,A,,,0,9 254 | 10317,24,0,72,1.90,97,2016-06-04,2016-06-02,B,,,2,4 255 | 10318,56,0,69,1.58,,2016-04-12,2016-03-05,B,,,1,2 256 | 10319,41,1,51,2.30,,2016-07-07,2016-06-22,B,,,0,3 257 | 10320,51,1,67,2.08,96,2015-11-28,2016-02-22,A,,,1,1 258 | 10322,73,1,64,2.14,,2016-08-24,2016-09-19,B,,,0,6 259 | 10326,18,0,60,4.78,,2016-02-10,2016-02-08,B,,,, 260 | 10327,63,0,73,3.12,173,2016-09-09,2016-10-04,A,,,0,1 261 | 10328,39,0,68,1.62,94,2015-11-21,2016-01-28,A,,,0,1 262 | 10329,31,1,54,2.00,,2016-05-04,2016-04-26,A,2016-11-26,,0,5 263 | 10330,73,1,72,1.52,,2016-08-01,2016-06-06,B,,,0,5 264 | 10331,19,1,53,7.26,111,2017-01-15,2017-02-25,A,,,0,3 265 | 10332,58,1,70,7.18,,2015-09-26,2015-12-08,B,,,0,2 266 | 10333,39,0,68,3.06,100,2016-01-23,2015-10-27,B,2016-11-23,,1,3 267 | 10334,61,1,64,1.66,108,2017-02-01,2017-01-18,A,,,0,2 268 | 10335,31,1,52,3.46,,2016-03-03,2016-03-14,A,,,0,2 269 | 10336,37,1,71,2.22,78,2015-12-03,2015-11-01,A,,,0,7 270 | 10337,32,1,54,2.60,72,2015-12-31,2015-12-15,B,,,0,2 271 | 10338,58,1,71,2.06,171,2016-10-04,2016-09-08,A,,,1,8 272 | 10339,57,1,56,6.02,,2016-05-26,2016-05-22,B,2016-09-05,2017-03-20,0,2 273 | 10341,51,1,53,1.82,186,2015-12-13,2016-01-20,B,,,0,2 274 | 10342,73,1,57,,129,2016-04-24,2016-03-21,B,,,1,6 275 | 10343,61,0,95,3.26,85,2014-02-20,2014-04-14,B,2015-05-07,2015-10-20,1,6 276 | 10344,53,1,74,1.74,128,2014-06-15,2014-07-12,A,,,0,21 277 | 10346,56,0,84,4.20,143,2014-09-08,2014-11-10,B,2016-05-26,2018-08-27,, 278 | 10347,61,1,76,2.46,126,2017-04-17,2017-03-04,A,,,, 279 | 10348,66,0,85,7.18,,2015-08-17,2015-05-20,A,,,0,2 280 | 10349,54,1,83,3.00,,2015-08-19,2015-08-14,A,,,, 281 | 10350,64,0,80,4.76,,2014-11-05,2014-10-15,B,2014-12-22,,0,3 282 | 10351,58,1,74,1.74,147,2014-09-17,2014-12-08,B,,,0,1 283 | 10352,55,0,99,4.96,291,2015-08-20,2015-05-07,B,2016-12-25,2017-08-02,, 284 | 10353,52,1,93,2.94,170,2015-08-12,2015-09-25,A,2016-04-16,,, 285 | 10354,55,1,76,6.68,172,2014-12-22,2015-01-10,A,,,0,10 286 | 10355,45,1,74,4.18,129,2014-05-16,2014-07-31,A,2014-08-06,2015-10-22,1,1 287 | 10356,74,1,101,2.04,,2015-01-28,2014-12-18,A,2015-11-02,,0,2 288 | 10357,54,0,91,9.64,114,2016-12-06,2017-01-11,B,2017-07-14,,0,3 289 | 10358,41,0,131,3.32,143,2015-02-20,2015-02-27,B,2015-07-12,,0,1 290 | 10359,37,0,82,3.06,147,2014-10-12,2014-11-20,A,2015-09-11,2015-12-03,0,2 291 | 10361,57,1,98,1.50,153,2015-12-08,2015-09-12,A,,,, 292 | 10363,60,0,92,3.84,155,2015-05-06,2015-08-22,B,,,0,5 293 | 10365,62,1,81,2.10,71,2016-06-25,2016-08-11,B,,,0,6 294 | 10366,46,1,79,,170,2015-03-03,2015-01-15,B,,,0,2 295 | 10368,55,1,53,,118,2017-06-30,2017-08-26,B,,,0,4 296 | 10371,58,0,56,4.92,177,2015-01-30,2015-01-28,B,2017-03-10,2017-10-25,0,2 297 | 10372,26,1,55,3.54,143,2015-01-27,2015-01-21,A,,,2,7 298 | 10374,41,1,54,4.08,105,2015-07-20,2015-06-28,B,,,2,10 299 | 10377,58,1,76,,116,2017-08-01,2017-06-20,A,,,0,7 300 | 10378,56,0,80,1.86,227,2017-04-13,2017-04-07,A,,,0,1 301 | 10379,66,0,75,,,2017-05-20,2017-03-17,B,,,0,2 302 | 10380,61,0,98,2.16,182,2017-04-24,2017-04-14,B,,,0,1 303 | 10381,52,1,76,2.02,100,2017-04-18,2017-03-29,A,,,1,4 304 | 10382,34,1,74,,,2017-07-09,2017-07-10,B,,,0,1 305 | 10385,49,0,93,2.28,,2017-03-28,2017-05-27,A,,,0,5 306 | 10387,57,0,95,8.58,,2017-05-19,2017-04-27,B,2017-12-09,,0,4 307 | 10388,61,0,95,2.42,115,2017-04-12,2017-05-14,B,,,0,4 308 | 10389,64,0,101,2.88,116,2017-08-19,2017-07-13,B,,,0,1 309 | 10390,22,0,76,2.58,87,2017-05-09,2017-04-25,A,,,0,2 310 | 10391,43,0,84,,,2017-06-30,2017-07-07,B,,,0,3 311 | 10392,33,0,107,,150,2017-09-16,2017-09-14,A,,,, 312 | 10394,63,1,81,,,2017-08-23,2017-06-16,A,,,, 313 | 10395,62,0,84,5.18,151,2017-08-30,2017-09-30,B,,,0,2 314 | 10396,40,0,63,4.14,73,2017-06-05,2017-05-07,B,,,0,2 315 | 10399,29,1,49,2.10,129,2017-07-15,2017-04-07,A,,,0,2 316 | 10400,66,1,67,2.00,,2017-03-23,2017-05-27,A,,,0,1 317 | 10401,39,1,74,3.54,,2017-07-02,2017-08-19,A,,,0,7 318 | 10402,52,1,59,4.92,141,2017-07-14,2017-06-17,B,,,0,2 319 | 10403,64,0,68,2.40,187,2017-03-10,2017-05-03,B,,,0,4 320 | 10404,30,1,59,1.94,,2017-08-24,2017-08-17,B,2018-02-11,,0,2 321 | 10405,49,1,64,2.72,,2017-08-10,2017-06-23,A,,,0,1 322 | 10406,60,0,85,2.06,109,2015-11-28,2016-02-25,A,,,0,1 323 | 10407,31,0,57,10.04,80,2015-08-18,2015-11-21,A,,,0,7 324 | ;;;; 325 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_patients_recruitment.sas: -------------------------------------------------------------------------------- 1 | data WORK.PATIENTS_RECRUITMENT; 2 | infile datalines dsd truncover; 3 | input Randdate:MONYY7. PatientCnt:32.; 4 | format Randdate:MONYY7. PatientCnt:32.; 5 | datalines4; 6 | APR2005,1 7 | MAY2005,3 8 | JUN2005,5 9 | JUL2005,5 10 | AUG2005,6 11 | SEP2005,4 12 | OCT2005,3 13 | NOV2005,7 14 | DEC2005,4 15 | JAN2006,7 16 | FEB2006,9 17 | MAR2006,4 18 | APR2006,4 19 | MAY2006,6 20 | JUN2006,4 21 | JUL2006,7 22 | AUG2006,5 23 | SEP2006,7 24 | OCT2006,4 25 | NOV2006,10 26 | DEC2006,5 27 | JAN2007,9 28 | FEB2007,1 29 | MAR2007,6 30 | APR2007,6 31 | MAY2007,1 32 | JUN2007,3 33 | JUL2007,1 34 | AUG2007,4 35 | SEP2007,3 36 | OCT2007,3 37 | NOV2007,1 38 | DEC2007,5 39 | JAN2008,6 40 | FEB2008,5 41 | MAR2008,4 42 | APR2008,4 43 | MAY2008,3 44 | JUN2008,7 45 | JUL2008,8 46 | AUG2008,13 47 | SEP2008,10 48 | OCT2008,6 49 | NOV2008,8 50 | DEC2008,9 51 | JAN2009,7 52 | FEB2009,3 53 | MAR2009,9 54 | APR2009,6 55 | MAY2009,2 56 | JUN2009,6 57 | JUL2009,7 58 | AUG2009,7 59 | SEP2009,4 60 | OCT2009,11 61 | NOV2009,3 62 | DEC2009,4 63 | JAN2010,7 64 | FEB2010,6 65 | MAR2010,5 66 | APR2010,3 67 | MAY2010,7 68 | JUN2010,9 69 | JUL2010,9 70 | AUG2010,6 71 | SEP2010,7 72 | OCT2010,4 73 | NOV2010,3 74 | DEC2010,5 75 | JAN2011,12 76 | FEB2011,5 77 | MAR2011,3 78 | APR2011,9 79 | MAY2011,1 80 | JUN2011,1 81 | ;;;; 82 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_projects.sas: -------------------------------------------------------------------------------- 1 | data WORK.PROJECTS; 2 | infile datalines dsd truncover; 3 | input ProjectID:BEST12. value:BEST12. prob:BEST12.; 4 | format ProjectID:BEST12. value:BEST12. prob:BEST12.; 5 | datalines4; 6 | 1,1500,0.1 7 | 2,10,0.65 8 | 3,500,0.2 9 | 4,50,0.5 10 | 5,100,0.4 11 | 6,30,0.9 12 | 7,10,0.6 13 | 8,150,0.2 14 | 9,200,0.25 15 | 10,180,0.1 16 | 11,900,0.1 17 | 12,750,0.2 18 | 13,600,0.1 19 | 14,320,0.2 20 | 15,100,0.4 21 | 16,50,0.8 22 | 17,2000,0.05 23 | 18,400,0.2 24 | 19,2500,0.1 25 | 20,1700,0.15 26 | 21,100,0.8 27 | ;;;; 28 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_property_costrevenue.sas: -------------------------------------------------------------------------------- 1 | data WORK.PROPERTY_COSTREVENUE; 2 | infile datalines dsd truncover; 3 | input Field:BEST12. M0:BEST12. M1:BEST12. M2:BEST12. M3:BEST12. M4:BEST12. M5:BEST12. M6:BEST12. K0:BEST12. K1:BEST12.; 4 | format Field:BEST12. M0:BEST12. M1:BEST12. M2:BEST12. M3:BEST12. M4:BEST12. M5:BEST12. M6:BEST12. K0:BEST12. K1:BEST12.; 5 | datalines4; 6 | 2,0.2,1,3,9,16,25,75,6,5 7 | 4,0.4,2,6,18,32,45,95,6,5 8 | 5,0.5,3,8,24,36,50,95,8,5 9 | 8,0.6,3,9,27,40,55,105,10,5 10 | 9,0.6,3,9,27,40,55,105,10,5 11 | 12,0.6,3,9,27,40,55,105,10,5 12 | 13,0.8,4,10,30,45,60,105,12,5 13 | 16,1,5,15,45,62,75,125,14,10 14 | 17,1,5,15,45,62,75,125,14,10 15 | 19,1,5,15,45,62,75,125,14,10 16 | 20,1.2,6,18,50,70,90,140,16,10 17 | 22,1.4,7,20,55,75,95,145,18,10 18 | 24,1.4,7,20,55,75,95,145,18,10 19 | 25,1.6,8,22,60,80,100,150,20,10 20 | 26,1.6,8,22,60,80,100,150,20,10 21 | 28,1.8,9,25,70,87.5,105,205,22,15 22 | 30,1.8,9,25,70,87.5,105,205,22,15 23 | 31,2,10,30,75,92.5,110,210,24,15 24 | 32,2,10,30,75,92.5,110,210,24,15 25 | 35,2.2,11,33,80,97.5,115,215,26,15 26 | 36,2.2,11,33,80,97.5,115,215,26,15 27 | 38,2.4,12,36,85,102.5,120,220,28,15 28 | 39,2.4,12,36,85,102.5,120,220,28,15 29 | 41,2.6,13,39,90,110,127.5,227.5,30,20 30 | 42,2.6,13,39,90,110,127.5,227.5,30,20 31 | 43,2.6,13,39,90,110,127.5,227.5,30,20 32 | 45,2.8,15,45,100,120,140,240,32,20 33 | 49,3.5,17.5,50,110,130,150,250,35,20 34 | 50,3.5,17.5,50,110,130,150,250,35,20 35 | 52,5,20,60,140,170,200,300,40,20 36 | ;;;; 37 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_sales_eur.sas: -------------------------------------------------------------------------------- 1 | data WORK.SALES_EUR; 2 | infile datalines dsd truncover; 3 | input date:YYMMN6. year:8. month:8. Sales_EUR:BEST12.; 4 | format date:YYMMN6. year:8. month:8. Sales_EUR:BEST12.; 5 | datalines4; 6 | 199708,1997,8,1007 7 | 199709,1997,9,1045 8 | 199710,1997,10,975 9 | 199711,1997,11,1095 10 | 199712,1997,12,1810 11 | 199801,1998,1,1045 12 | 199802,1998,2,1260 13 | 199803,1998,3,760 14 | 199804,1998,4,1005 15 | 199805,1998,5,1405 16 | 199806,1998,6,1513 17 | 199807,1998,7,1890 18 | 199808,1998,8,1085 19 | 199809,1998,9,1383 20 | 199810,1998,10,774 21 | 199811,1998,11,970 22 | 199812,1998,12,2203 23 | 199901,1999,1,1070 24 | 199902,1999,2,945 25 | 199903,1999,3,839 26 | 199904,1999,4,1885 27 | 199905,1999,5,1740 28 | 199906,1999,6,2083 29 | 199907,1999,7,1286 30 | 199908,1999,8,2171 31 | 199909,1999,9,1546 32 | 199910,1999,10,1050 33 | 199911,1999,11,670 34 | 199912,1999,12,1861 35 | 200001,2000,1,1395 36 | 200002,2000,2,2240 37 | 200003,2000,3,924 38 | 200004,2000,4,1320 39 | 200005,2000,5,2240 40 | 200006,2000,6,1856 41 | 200007,2000,7,2018 42 | 200008,2000,8,1146 43 | 200009,2000,9,2370 44 | 200010,2000,10,1535 45 | 200011,2000,11,1110 46 | 200012,2000,12,2245 47 | 200101,2001,1,1342 48 | 200102,2001,2,1158 49 | 200103,2001,3,2120 50 | 200104,2001,4,1560 51 | 200105,2001,5,2456 52 | 200106,2001,6,1568 53 | 200107,2001,7,1886 54 | 200108,2001,8,2689 55 | 200109,2001,9,1827 56 | 200110,2001,10,1630 57 | 200111,2001,11,1810 58 | 200112,2001,12,2135 59 | 200201,2002,1,1447 60 | 200202,2002,2,958 61 | 200203,2002,3,1770 62 | 200204,2002,4,1510 63 | 200205,2002,5,1676 64 | 200206,2002,6,1930 65 | 200207,2002,7,1776 66 | 200208,2002,8,2384 67 | 200209,2002,9,2148 68 | 200210,2002,10,665 69 | 200211,2002,11,1588 70 | 200212,2002,12,2110 71 | 200301,2003,1,1186 72 | 200302,2003,2,2125 73 | 200303,2003,3,1895 74 | 200304,2003,4,704 75 | 200305,2003,5,2087 76 | 200306,2003,6,1939 77 | 200307,2003,7,1221 78 | 200308,2003,8,2372 79 | 200309,2003,9,660 80 | 200310,2003,10,1101 81 | 200311,2003,11,1453 82 | 200312,2003,12,2568 83 | 200401,2004,1,505 84 | 200402,2004,2,1570 85 | 200403,2004,3,1705 86 | 200404,2004,4,2527 87 | 200405,2004,5,1389 88 | 200406,2004,6,1786 89 | 200407,2004,7,1874 90 | 200408,2004,8,2419 91 | 200409,2004,9,1075 92 | 200410,2004,10,1255 93 | 200411,2004,11,1198 94 | 200412,2004,12,2530 95 | 200501,2005,1,1480 96 | 200502,2005,2,1678 97 | 200503,2005,3,2089 98 | 200504,2005,4,1219 99 | 200505,2005,5,1917 100 | 200506,2005,6,1968 101 | 200507,2005,7,1480 102 | 200508,2005,8,2084 103 | 200509,2005,9,540 104 | 200510,2005,10,760 105 | 200511,2005,11,1068 106 | 200512,2005,12,2445 107 | 200601,2006,1,1083 108 | 200602,2006,2,1741 109 | 200603,2006,3,1665 110 | 200604,2006,4,1012 111 | 200605,2006,5,1725 112 | 200606,2006,6,1639 113 | 200607,2006,7,2178 114 | 200608,2006,8,2401 115 | 200609,2006,9,891 116 | 200610,2006,10,1654 117 | 200611,2006,11,1746 118 | 200612,2006,12,2055 119 | 200701,2007,1,1198 120 | 200702,2007,2,1851 121 | 200703,2007,3,1235 122 | 200704,2007,4,1109 123 | 200705,2007,5,1742 124 | 200706,2007,6,1710 125 | 200707,2007,7,1742 126 | 200708,2007,8,2519 127 | 200709,2007,9,1946 128 | 200710,2007,10,1404 129 | 200711,2007,11,1232 130 | 200712,2007,12,2091 131 | 200801,2008,1,971 132 | 200802,2008,2,2211 133 | 200803,2008,3,1319 134 | 200804,2008,4,800 135 | 200805,2008,5,2295 136 | 200806,2008,6,1563 137 | 200807,2008,7,2469 138 | 200808,2008,8,1897 139 | 200809,2008,9,1470 140 | 200810,2008,10,1160 141 | 200811,2008,11,1382 142 | 200812,2008,12,2460 143 | 200901,2009,1,1033 144 | 200902,2009,2,895 145 | 200903,2009,3,241 146 | 200904,2009,4,1596 147 | 200905,2009,5,1647 148 | 200906,2009,6,2393 149 | 200907,2009,7,1970 150 | 200908,2009,8,1769 151 | 200909,2009,9,650 152 | 200910,2009,10,1509 153 | 200911,2009,11,1430 154 | 200912,2009,12,3288 155 | 201001,2010,1,1146 156 | 201002,2010,2,1416 157 | 201003,2010,3,320 158 | 201004,2010,4,1320 159 | 201005,2010,5,2843 160 | 201006,2010,6,1793 161 | 201007,2010,7,2305 162 | 201008,2010,8,2005 163 | 201009,2010,9,1513 164 | 201010,2010,10,1784 165 | 201011,2010,11,537 166 | 201012,2010,12,2776 167 | 201101,2011,1,333 168 | 201102,2011,2,1756 169 | 201103,2011,3,786 170 | 201104,2011,4,1057 171 | 201105,2011,5,2047 172 | 201106,2011,6,2119 173 | 201107,2011,7,2237 174 | 201108,2011,8,2552 175 | 201109,2011,9,1433 176 | 201110,2011,10,1854 177 | 201111,2011,11,537 178 | 201112,2011,12,2776 179 | 201201,2012,1,100 180 | 201202,2012,2,2510 181 | 201203,2012,3,160 182 | 201204,2012,4,1790 183 | 201205,2012,5,1950 184 | 201206,2012,6,2611 185 | 201207,2012,7,1980 186 | 201208,2012,8,2510 187 | 201209,2012,9,541 188 | 201210,2012,10,2164 189 | 201211,2012,11,1085 190 | 201212,2012,12,2596 191 | 201301,2013,1,730 192 | 201302,2013,2,514 193 | 201303,2013,3,465 194 | 201304,2013,4,960 195 | 201305,2013,5,1770 196 | 201306,2013,6,2057 197 | 201307,2013,7,1987 198 | 201308,2013,8,2953 199 | 201309,2013,9,2113 200 | 201310,2013,10,1612 201 | 201311,2013,11,1517 202 | 201312,2013,12,3173 203 | 201401,2014,1,610 204 | 201402,2014,2,1049 205 | 201403,2014,3,524 206 | 201404,2014,4,740 207 | 201405,2014,5,1547 208 | 201406,2014,6,2836 209 | 201407,2014,7,1572 210 | 201408,2014,8,3435 211 | 201409,2014,9,1135 212 | 201410,2014,10,2270 213 | 201411,2014,11,780 214 | 201412,2014,12,3443 215 | 201501,2015,1,324 216 | 201502,2015,2,825 217 | 201503,2015,3,426 218 | ;;;; 219 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_sales_historic.sas: -------------------------------------------------------------------------------- 1 | data WORK.SALES_HISTORIC; 2 | infile datalines dsd truncover; 3 | input AccountManager:$12. Month:32. Sales_EUR:32.; 4 | format AccountManager:$12. Month:32. Sales_EUR:32.; 5 | datalines4; 6 | Alfred,1,1186 7 | Alfred,2,2125 8 | Alfred,3,1895 9 | Alfred,4,704 10 | Alfred,5,2087 11 | Alfred,6,1939 12 | Alfred,7,1221 13 | Alfred,8,2372 14 | Alfred,9,660 15 | Alfred,10,1101 16 | Alfred,11,1453 17 | Alfred,12,2568 18 | Alice,1,505 19 | Alice,2,1570 20 | Alice,3,1605 21 | Alice,4,2467 22 | Alice,5,1524 23 | Alice,6,1811 24 | Alice,7,1849 25 | Alice,8,2254 26 | Alice,9,1240 27 | Alice,10,1254 28 | Alice,11,1224 29 | Alice,12,2380 30 | Barbara,1,1480 31 | Barbara,2,1678 32 | Barbara,3,2089 33 | Barbara,4,1219 34 | Barbara,5,1917 35 | Barbara,6,1968 36 | Barbara,7,1480 37 | Barbara,8,2084 38 | Barbara,9,540 39 | Barbara,10,760 40 | Barbara,11,1068 41 | Barbara,12,2445 42 | Carol,1,1083 43 | Carol,2,1741 44 | Carol,3,1645 45 | Carol,4,1012 46 | Carol,5,1725 47 | Carol,6,1639 48 | Carol,7,2178 49 | Carol,8,2401 50 | Carol,9,891 51 | Carol,10,1654 52 | Carol,11,1746 53 | Carol,12,2055 54 | Henry,1,1198 55 | Henry,2,1851 56 | Henry,3,1235 57 | Henry,4,1109 58 | Henry,5,1742 59 | Henry,6,1710 60 | Henry,7,1742 61 | Henry,8,2518 62 | Henry,9,1946 63 | Henry,10,1404 64 | Henry,11,1232 65 | Henry,12,2091 66 | James,1,971 67 | James,2,2121 68 | James,3,1409 69 | James,4,800 70 | James,5,2145 71 | James,6,1713 72 | James,7,2469 73 | James,8,1897 74 | James,9,1370 75 | James,10,1260 76 | James,11,1382 77 | James,12,2290 78 | Jane,1,1033 79 | Jane,2,895 80 | Jane,3,241 81 | Jane,4,1596 82 | Jane,5,1647 83 | Jane,6,2393 84 | Jane,7,1970 85 | Jane,8,1769 86 | Jane,9,650 87 | Jane,10,1509 88 | Jane,11,1430 89 | Jane,12,3288 90 | Janet,1,1146 91 | Janet,2,1421 92 | Janet,3,320 93 | Janet,4,1320 94 | Janet,5,2843 95 | Janet,6,1793 96 | Janet,7,2305 97 | Janet,8,2165 98 | Janet,9,1353 99 | Janet,10,1784 100 | Janet,11,537 101 | Janet,12,2776 102 | Jeffrey,1,333 103 | Jeffrey,2,1756 104 | Jeffrey,3,786 105 | Jeffrey,4,1057 106 | Jeffrey,5,2047 107 | Jeffrey,6,2119 108 | Jeffrey,7,2237 109 | Jeffrey,8,2552 110 | Jeffrey,9,1433 111 | Jeffrey,10,1854 112 | Jeffrey,11,912 113 | Jeffrey,12,2778 114 | John,1,100 115 | John,2,2360 116 | John,3,310 117 | John,4,1790 118 | John,5,1950 119 | John,6,2611 120 | John,7,1760 121 | John,8,2730 122 | John,9,541 123 | John,10,1994 124 | John,11,1215 125 | John,12,2354 126 | Joyce,1,730 127 | Joyce,2,514 128 | Joyce,3,465 129 | Joyce,4,960 130 | Joyce,5,1770 131 | Joyce,6,2057 132 | Joyce,7,1987 133 | Joyce,8,2953 134 | Joyce,9,2113 135 | Joyce,10,1612 136 | Joyce,11,1517 137 | Joyce,12,3163 138 | ;;;; 139 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_sales_month.sas: -------------------------------------------------------------------------------- 1 | data WORK.SALES_MONTH; 2 | infile datalines dsd truncover; 3 | input AccountManager:$12. Month:32. Sales_EUR:32.; 4 | format AccountManager:$12. Month:32. Sales_EUR:32.; 5 | datalines4; 6 | Alfred,1,1186 7 | Alfred,2,2125 8 | Alfred,3,1895 9 | Alfred,4,704 10 | Alfred,5,2087 11 | Alfred,6,1939 12 | Alfred,7,1221 13 | Alfred,8,2372 14 | Alfred,9,660 15 | Alfred,10,1101 16 | Alfred,11,1453 17 | Alfred,12,2568 18 | Alice,1,505 19 | Alice,2,1570 20 | Alice,3,1605 21 | Alice,4,2467 22 | Alice,5,1524 23 | Alice,6,1811 24 | Alice,7,1849 25 | Alice,8,2254 26 | Alice,9,1240 27 | Alice,10,1254 28 | Alice,11,1224 29 | Alice,12,2380 30 | Barbara,1,1480 31 | Barbara,2,1678 32 | Barbara,3,2089 33 | Barbara,4,1219 34 | Barbara,5,1917 35 | Barbara,6,1968 36 | Barbara,7,1480 37 | Barbara,8,2084 38 | Barbara,9,540 39 | Barbara,10,760 40 | Barbara,11,1068 41 | Barbara,12,2445 42 | Carol,1,1083 43 | Carol,2,1741 44 | Carol,3,1645 45 | Carol,4,1012 46 | Carol,5,1725 47 | Carol,6,1639 48 | Carol,7,2178 49 | Carol,8,2401 50 | Carol,9,891 51 | Carol,10,1654 52 | Carol,11,1746 53 | Carol,12,2055 54 | Henry,1,1198 55 | Henry,2,1851 56 | Henry,3,1235 57 | Henry,4,1109 58 | Henry,5,1742 59 | Henry,6,1710 60 | Henry,7,1742 61 | Henry,8,2518 62 | Henry,9,1946 63 | Henry,10,1404 64 | Henry,11,1232 65 | Henry,12,2091 66 | James,1,971 67 | James,2,2121 68 | James,3,1409 69 | James,4,800 70 | James,5,2145 71 | James,6,1713 72 | James,7,2469 73 | James,8,1897 74 | James,9,1370 75 | James,10,1260 76 | James,11,1382 77 | James,12,2290 78 | Jane,1,1033 79 | Jane,2,895 80 | Jane,3,241 81 | Jane,4,1596 82 | Jane,5,1647 83 | Jane,6,2393 84 | Jane,7,1970 85 | Jane,8,1769 86 | Jane,9,650 87 | Jane,10,1509 88 | Jane,11,1430 89 | Jane,12,3288 90 | Janet,1,1146 91 | Janet,2,1421 92 | Janet,3,320 93 | Janet,4,1320 94 | Janet,5,2843 95 | Janet,6,1793 96 | Janet,7,2305 97 | Janet,8,2165 98 | Janet,9,1353 99 | Janet,10,1784 100 | Janet,11,537 101 | Janet,12,2776 102 | Jeffrey,1,333 103 | Jeffrey,2,1756 104 | Jeffrey,3,786 105 | Jeffrey,4,1057 106 | Jeffrey,5,2047 107 | Jeffrey,6,2119 108 | Jeffrey,7,2237 109 | Jeffrey,8,2552 110 | Jeffrey,9,1433 111 | Jeffrey,10,1854 112 | Jeffrey,11,912 113 | Jeffrey,12,2778 114 | John,1,100 115 | John,2,2360 116 | John,3,310 117 | John,4,1790 118 | John,5,1950 119 | John,6,2611 120 | John,7,1760 121 | John,8,2730 122 | John,9,541 123 | John,10,1994 124 | John,11,1215 125 | John,12,2354 126 | Joyce,1,730 127 | Joyce,2,514 128 | Joyce,3,465 129 | Joyce,4,960 130 | Joyce,5,1770 131 | Joyce,6,2057 132 | Joyce,7,1987 133 | Joyce,8,2953 134 | Joyce,9,2113 135 | Joyce,10,1612 136 | Joyce,11,1517 137 | Joyce,12,3163 138 | ;;;; 139 | -------------------------------------------------------------------------------- /SAS Dataset as SAS-Programm/CREATE_DATA_sales_targetratios.sas: -------------------------------------------------------------------------------- 1 | data WORK.SALES_TARGETRATIOS; 2 | infile datalines dsd truncover; 3 | input EmpNo:4. FirstName:$12. Quarter:YYMMDD10. Target_Ratio:PERCENT8.; 4 | format EmpNo:4. FirstName:$12. Quarter:YYMMDD10. Target_Ratio:PERCENT8.; 5 | datalines4; 6 | 1002,Hugh,2005-01-01,77% 7 | 1002,Hugh,2005-04-01,74% 8 | 1002,Hugh,2005-07-01,77% 9 | 1002,Hugh,2005-10-01,83% 10 | 1002,Hugh,2006-01-01,71% 11 | 1002,Hugh,2006-04-01,38% 12 | 1002,Hugh,2006-07-01,81% 13 | 1002,Hugh,2006-10-01,63% 14 | 1002,Hugh,2007-01-01,54% 15 | 1002,Hugh,2007-04-01,48% 16 | 1002,Hugh,2007-07-01,54% 17 | 1002,Hugh,2007-10-01,48% 18 | 1002,Hugh,2008-01-01,58% 19 | 1002,Hugh,2008-04-01,29% 20 | 1002,Hugh,2008-07-01,63% 21 | 1002,Hugh,2008-10-01,67% 22 | 1002,Hugh,2009-01-01,43% 23 | 1002,Hugh,2009-04-01,64% 24 | 1002,Hugh,2009-07-01,74% 25 | 1002,Hugh,2009-10-01,53% 26 | 1002,Hugh,2010-01-01,74% 27 | 1002,Hugh,2010-04-01,58% 28 | 1002,Hugh,2010-07-01,76% 29 | 1002,Hugh,2010-10-01,55% 30 | 1002,Hugh,2011-01-01,61% 31 | 1008,Peter,2007-10-01,66% 32 | 1008,Peter,2008-01-01,71% 33 | 1008,Peter,2008-04-01,75% 34 | 1008,Peter,2008-07-01,72% 35 | 1008,Peter,2008-10-01,81% 36 | 1008,Peter,2009-01-01,72% 37 | 1008,Peter,2009-04-01,67% 38 | 1008,Peter,2009-07-01,65% 39 | 1008,Peter,2009-10-01,72% 40 | 1008,Peter,2010-01-01,81% 41 | 1008,Peter,2010-04-01,74% 42 | 1008,Peter,2010-07-01,55% 43 | 1008,Peter,2010-10-01,86% 44 | 1008,Peter,2011-01-01,61% 45 | 1008,Peter,2011-04-01,68% 46 | 1008,Peter,2011-07-01,64% 47 | 1008,Peter,2011-10-01,85% 48 | 1008,Peter,2012-01-01,90% 49 | 1013,Thomas,2008-04-01,115% 50 | 1013,Thomas,2008-07-01,99% 51 | 1013,Thomas,2008-10-01,88% 52 | 1013,Thomas,2009-01-01,121% 53 | 1013,Thomas,2009-04-01,95% 54 | 1013,Thomas,2009-07-01,94% 55 | 1014,Bert,2008-04-01,97% 56 | 1014,Bert,2008-07-01,102% 57 | 1014,Bert,2008-10-01,88% 58 | 1014,Bert,2009-01-01,98% 59 | 1014,Bert,2009-04-01,93% 60 | 1014,Bert,2009-07-01,98% 61 | 1014,Bert,2009-10-01,100% 62 | 1014,Bert,2010-01-01,88% 63 | 1014,Bert,2010-04-01,92% 64 | 1022,Frank,2009-07-01,97% 65 | 1022,Frank,2009-10-01,80% 66 | 1022,Frank,2010-01-01,95% 67 | 1022,Frank,2010-04-01,107% 68 | 1027,Brian,2009-10-01,88% 69 | 1027,Brian,2010-01-01,64% 70 | 1027,Brian,2010-04-01,94% 71 | 1027,Brian,2010-07-01,92% 72 | 1027,Brian,2010-10-01,92% 73 | 1028,Pawel,2009-10-01,81% 74 | 1028,Pawel,2010-01-01,97% 75 | 1028,Pawel,2010-04-01,92% 76 | 1028,Pawel,2010-07-01,95% 77 | 1028,Pawel,2010-10-01,85% 78 | 1028,Pawel,2011-01-01,78% 79 | 1028,Pawel,2011-04-01,91% 80 | 1028,Pawel,2011-07-01,91% 81 | 1028,Pawel,2011-10-01,92% 82 | 1028,Pawel,2012-01-01,96% 83 | 1041,Matthew,2010-10-01,95% 84 | 1041,Matthew,2011-01-01,81% 85 | 1041,Matthew,2011-04-01,72% 86 | 1041,Matthew,2011-07-01,76% 87 | 1041,Matthew,2011-10-01,93% 88 | 1041,Matthew,2012-01-01,97% 89 | 1043,Martina,2011-01-01,92% 90 | 1043,Martina,2011-04-01,102% 91 | 1043,Martina,2011-07-01,96% 92 | 1043,Martina,2011-10-01,90% 93 | 1046,Martin,2011-04-01,101% 94 | 1047,Richard,2011-04-01,91% 95 | 1048,Kim,2011-04-01,90% 96 | 1048,Kim,2011-07-01,91% 97 | 1048,Kim,2011-10-01,102% 98 | 1048,Kim,2012-01-01,105% 99 | 1048,Kim,2012-04-01,100% 100 | 1049,Charles,2011-04-01,76% 101 | 1049,Charles,2011-07-01,75% 102 | 1049,Charles,2011-10-01,99% 103 | 1049,Charles,2012-01-01,63% 104 | 1049,Charles,2012-04-01,102% 105 | 1049,Charles,2012-07-01,84% 106 | 1049,Charles,2012-10-01,76% 107 | 1049,Charles,2013-01-01,77% 108 | 1049,Charles,2013-04-01,93% 109 | 1049,Charles,2013-07-01,82% 110 | 1049,Charles,2013-10-01,86% 111 | 1050,Elias,2011-07-01,98% 112 | 1050,Elias,2011-10-01,83% 113 | 1050,Elias,2012-01-01,79% 114 | 1050,Elias,2012-04-01,82% 115 | 1050,Elias,2012-07-01,91% 116 | 1050,Elias,2012-10-01,82% 117 | 1050,Elias,2013-01-01,73% 118 | 1050,Elias,2013-04-01,97% 119 | 1050,Elias,2013-07-01,65% 120 | 1052,Iwona,2012-01-01,108% 121 | 1052,Iwona,2012-04-01,67% 122 | 1052,Iwona,2012-07-01,104% 123 | 1052,Iwona,2012-10-01,99% 124 | 1052,Iwona,2013-01-01,98% 125 | 1052,Iwona,2013-04-01,93% 126 | 1052,Iwona,2013-07-01,100% 127 | 1057,Didier,2012-04-01,96% 128 | 1057,Didier,2012-07-01,61% 129 | 1057,Didier,2012-10-01,77% 130 | 1057,Didier,2013-01-01,73% 131 | 1057,Didier,2013-04-01,85% 132 | 1057,Didier,2013-07-01,80% 133 | 1057,Didier,2013-10-01,88% 134 | 1057,Didier,2014-01-01,84% 135 | 1057,Didier,2014-04-01,84% 136 | 1057,Didier,2014-07-01,76% 137 | 1057,Didier,2014-10-01,74% 138 | 1057,Didier,2015-01-01,74% 139 | 1057,Didier,2015-04-01,81% 140 | 1057,Didier,2015-07-01,95% 141 | 1057,Didier,2015-10-01,87% 142 | 1062,Ernest,2012-10-01,81% 143 | 1062,Ernest,2013-01-01,91% 144 | 1062,Ernest,2013-04-01,85% 145 | 1062,Ernest,2013-07-01,91% 146 | 1062,Ernest,2013-10-01,101% 147 | 1062,Ernest,2014-01-01,92% 148 | 1062,Ernest,2014-04-01,104% 149 | 1062,Ernest,2014-07-01,90% 150 | 1062,Ernest,2014-10-01,98% 151 | 1062,Ernest,2015-01-01,81% 152 | 1063,Olaf,2013-01-01,90% 153 | 1063,Olaf,2013-04-01,90% 154 | 1063,Olaf,2013-07-01,83% 155 | 1063,Olaf,2013-10-01,97% 156 | 1063,Olaf,2014-01-01,94% 157 | 1063,Olaf,2014-04-01,110% 158 | 1063,Olaf,2014-07-01,91% 159 | 1063,Olaf,2014-10-01,114% 160 | 1063,Olaf,2015-01-01,86% 161 | 1063,Olaf,2015-04-01,94% 162 | 1063,Olaf,2015-07-01,89% 163 | 1063,Olaf,2015-10-01,92% 164 | 1063,Olaf,2016-01-01,94% 165 | 1063,Olaf,2016-04-01,103% 166 | 1063,Olaf,2016-07-01,106% 167 | 1063,Olaf,2016-10-01,77% 168 | 1063,Olaf,2017-01-01,91% 169 | 1064,Joe,2014-01-01,99% 170 | 1064,Joe,2014-04-01,77% 171 | 1064,Joe,2014-07-01,103% 172 | 1064,Joe,2014-10-01,82% 173 | 1064,Joe,2015-01-01,96% 174 | 1065,Nick,2014-01-01,77% 175 | 1065,Nick,2014-04-01,71% 176 | 1065,Nick,2014-07-01,84% 177 | 1065,Nick,2014-10-01,71% 178 | 1065,Nick,2015-01-01,89% 179 | 1065,Nick,2015-04-01,86% 180 | 1065,Nick,2015-07-01,96% 181 | 1065,Nick,2015-10-01,82% 182 | 1065,Nick,2016-01-01,84% 183 | 1065,Nick,2016-04-01,89% 184 | 1065,Nick,2016-07-01,91% 185 | 1065,Nick,2016-10-01,80% 186 | 1070,Robin,2015-01-01,112% 187 | 1070,Robin,2015-04-01,89% 188 | 1070,Robin,2015-07-01,95% 189 | 1070,Robin,2015-10-01,105% 190 | 1070,Robin,2016-01-01,86% 191 | 1071,Conrad,2015-01-01,130% 192 | 1071,Conrad,2015-04-01,115% 193 | 1071,Conrad,2015-07-01,112% 194 | 1071,Conrad,2015-10-01,111% 195 | 1071,Conrad,2016-01-01,120% 196 | 1071,Conrad,2016-04-01,108% 197 | 1071,Conrad,2016-07-01,126% 198 | 1071,Conrad,2016-10-01,134% 199 | 1071,Conrad,2017-01-01,95% 200 | 1076,Alf,2015-07-01,101% 201 | 1076,Alf,2015-10-01,101% 202 | 1076,Alf,2016-01-01,92% 203 | 1078,Jack,2016-01-01,110% 204 | 1078,Jack,2016-04-01,114% 205 | 1078,Jack,2016-07-01,122% 206 | 1078,Jack,2016-10-01,97% 207 | 1078,Jack,2017-01-01,112% 208 | 1083,Kilian,2016-04-01,108% 209 | 1083,Kilian,2016-07-01,99% 210 | 1083,Kilian,2016-10-01,112% 211 | 1083,Kilian,2017-01-01,125% 212 | 1087,Serge,2016-07-01,137% 213 | 1087,Serge,2016-10-01,113% 214 | 1087,Serge,2017-01-01,116% 215 | 1089,Bruce,2016-07-01,126% 216 | 1089,Bruce,2016-10-01,113% 217 | 1089,Bruce,2017-01-01,127% 218 | 1091,Guido,2016-10-01,126% 219 | 1091,Guido,2017-01-01,104% 220 | ;;;; 221 | -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/airlinepassengerssmooth.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/airlinepassengerssmooth.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/bank.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/bank.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/claims_nodup.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/claims_nodup.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/employees.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/employees.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/flights_911.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/flights_911.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/manfc.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/manfc.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/material.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/material.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/patients.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/patients.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/patients_recruitment.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/patients_recruitment.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/product_base.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/product_base.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/product_demand.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/product_demand.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/projects.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/projects.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/property_costrevenue.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/property_costrevenue.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/sales_eur.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/sales_eur.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/sales_historic.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/sales_historic.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/sales_month.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/sales_month.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/sales_targetratios.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/sales_targetratios.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/statfc.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/statfc.sas7bdat -------------------------------------------------------------------------------- /SAS Datasets as Windows_sas7bdat/transactions.sas7bdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Datasets as Windows_sas7bdat/transactions.sas7bdat -------------------------------------------------------------------------------- /SAS Enterprise Guide Project (with programs and datasets)/ApplyingDataScience_FullSASContent_V1.egp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerhard1050/Applying-Data-Science-Using-SAS/9ae72a3c470cf54ba89c347149bc47181b48b9e8/SAS Enterprise Guide Project (with programs and datasets)/ApplyingDataScience_FullSASContent_V1.egp --------------------------------------------------------------------------------