GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Applying-Data-Science-Using-SAS/Chapter 10.sas at master · Deepak12545/Applying-Data-Science-Using-SAS Expand file tree/ Copy pathChapter 10.sasMore file actions 275 lines (177 loc) · 5.13 KB / Copy pathChapter 10.sasFile metadata and controls275 lines (177 loc) · 5.13 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 proc format; value mid 1 = ' LONG Pure' 4 = 'SHORT ShiftLevel' 5 = 'LONG XT' 6 = 'LONG DownTrend' 7 = ' SHORT XT'; run; *** 10.4; proc sort data=statfc out=statfc_sort; by id target_month create_month; run; proc sort data=manfc out=manfc_sort; by id target_month create_month; run; data fc_all fc fc_statonly fc_manonly fc_ActualQu_mismatch ; merge statfc_sort (in=in_stat rename=(Actual=ActualStat)) manfc_sort (in=In_man rename=(Actual=ActualMan)); by id target_month create_month; format model mid.; Stat_IND = in_stat; Man_IND = in_man; StatMan_IND = cats(stat_ind,man_ind); rename ActualStat = Actual; rename ManFC = JudgmFC; drop ActualMan; output fc_all; if in_stat and in_man then do; if ActualStat =ActualMan then output fc; else output fc_ActualQu_mismatch; end; else if in_stat then output fc_statonly; else output fc_manonly; run; proc sql; create table material_view as select b.id, b.Product_Group, b.Price_Index , b.Launch_Date format = yymmddp12. from material as b; quit; proc sql; create table fc_mart as select a.*, b.Product_Group, b.Price_Index , b.Launch_Date , month(b.Launch_Date) as Launch_Month, year(b.Launch_Date) as Launch_Year from fc as a right join material as b on a.id = b.id where a.actual > 0 and a.actual ne . order by id, target_month, create_month; quit; data fc_mart; format FC_ID 8.; set fc_mart; FC_ID = _N_; if price_index in (0,999) then Price_Index = .; /*** FC-derived variables ***/ Create_CalMonth = month(create_month); Create_Year = year(create_month); Target_CalMonth = month(target_month); Target_Year = year(target_month); /*** Lead Times ***/ Lead_Time = intck('MONTH',create_month,target_month); Product_Age = intck('MONTH',launch_date,target_month); if Product_Age > 120 then Product_Age=120; /*** MAPE-Block ***/ format APE_Stat APE_Judgm APE_Stat_Shift APE_Judgm_shift 8.1; APE_Stat = abs(statfc - actual)/actual * 100; APE_Judgm= abs(JudgmFC - actual)/actual * 100; APE_stat_shift = min(ape_stat,300); APE_Judgm_shift = min(ape_Judgm,300); APE_STAT_LOG = log(ape_stat); APE_Judgm_LOG = log(ape_judgm); if Actual > 50 and StatFC not in (0,.) and JudgmFC not in (0,.); label Price_Index = "Price_Index"; run; /*** Launch Year Relativ ***/ /*** Create_Year_Rel = Create_Year - 2009; TimeID_Year_Rel = TimeID_Year - 2009; Laun_Year_Rel = Laun_Year - 1980; ***/ *** 10.5 Univariate Ergebnissse; proc means data=fc_mart mean std n min p10 q1 median q3 p90 p95 max maxdec=1; var APE_Stat; run; PROC SGPLOT DATA=fc_mart; histogram APE_Stat_shift; refline 86.5 / axis=x label="Mean"; refline 40.6 / axis=x label="Median"; RUN; PROC SGPLOT DATA=fc_mart; histogram APE_Stat_LOG; RUN; PROC SGPLOT DATA = fc_mart; VBOX ape_stat / CATEGORY=product_group NOOUTLIERS; yaxis max=300; RUN; PROC SGPLOT DATA = fc_mart; VBOX ape_stat / CATEGORY=Launch_Month NOOUTLIERS; yaxis max=300; RUN; PROC SGPLOT DATA = fc_mart; VBOX ape_stat / CATEGORY=Lead_time NOOUTLIERS; yaxis max=300; RUN; proc sgplot DATA = fc_mart; ; vbar lead_time; run; PROC SGPLOT DATA = fc_mart; VBOX ape_stat / CATEGORY=target_calmonth NOOUTLIERS; yaxis max=300 ; RUN; PROC SGPLOT DATA = fc_mart; VBOX ape_stat / CATEGORY=model NOOUTLIERS; yaxis max=300 ; RUN; proc sgpanel data=fc_mart; panelby model / novarname; vbox ape_stat_shift / category=Target_year nooutliers; run; PROC MEANS DATA=fc_mart NWAY NOPRINT; VAR ape_stat; CLASS model Target_year; OUTPUT OUT=ape_means mean= median= /autoname; RUN; PROC SGPLOT DATA=ape_means; SERIES X=Target_year Y=ape_stat_median / group=model; YAXIS LABEL ="APE_STAT" min=0 max=100; RUN; proc format; value mid_tmp 1 = 'LONG' 4 = 'SHORT' 5 = 'LONG' 6 = 'LONG' 7 = 'SHORT'; run; PROC MEANS DATA=fc_mart NWAY NOPRINT; format model mid_tmp.; VAR ape_stat; CLASS model Target_year; OUTPUT OUT=ape_means_2grp mean= median= /autoname; RUN; PROC SGPLOT DATA=ape_means_2grp; SERIES X=Target_year Y=ape_stat_median / group=model; YAXIS LABEL ="APE_STAT" min=0 max=100; RUN; PROC MEANS DATA=fc_mart NWAY NOPRINT; VAR ape_stat; CLASS product_age; OUTPUT OUT=quartile_age MEDIAN=median Q1=q1 Q3=q3; RUN; PROC SGPLOT DATA=quartile_age noautolegend; band lower=q1 upper=q3 X=product_age ; SERIES X=product_age Y=median; YAXIS LABEL ="APE_STAT"; RUN; PROC MEANS DATA=fc_mart NWAY NOPRINT; VAR ape_stat; CLASS price_index; OUTPUT OUT=quartile_Price MEDIAN=median Q1=q1 Q3=q3; RUN; PROC SGPLOT DATA=quartile_Price noautolegend; band lower=q1 upper=q3 X=price_index ; SERIES X=price_index Y=median; YAXIS LABEL ="APE_STAT"; where price_index < 500; RUN; |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |