*------------------------------------------------------------* User: zachf Date: September 10, 2015 Time: 10:02:49 Site: 70164444 Platform: X64_DSRV12 Maintenance Release: 9.04.01M1P120413 EM Version: 13.1 * *------------------------------------------------------------* * Training Log Date: September 10, 2015 Time: 10:02:39 *------------------------------------------------------------* 14561 proc freq data=EMWS5.Report_VariableSet noprint; 14562 table ROLE*LEVEL/out=WORK.ReportMETA; 14563 run; NOTE: There were 1129 observations read from the data set EMWS5.REPORT_VARIABLESET. NOTE: The data set WORK.REPORTMETA has 14 observations and 4 variables. NOTE: PROCEDURE FREQ used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 14564 proc print data=WORK.ReportMETA label noobs; 14565 var ROLE LEVEL COUNT; 14566 label ROLE = "%sysfunc(sasmsg(sashelp.dmine, meta_role_vlabel, NOQUOTE))" LEVEL = "%sysfunc(sasmsg(sashelp.dmine, meta_level_vlabel, NOQUOTE))" COUNT = "%sysfunc(sasmsg(sashelp.dmine, rpt_count_vlabel, NOQUOTE))"; 14567 title9 ' '; 14568 title10 "%sysfunc(sasmsg(sashelp.dmine, rpt_varSummary_title , NOQUOTE))"; 14569 run; NOTE: There were 14 observations read from the data set WORK.REPORTMETA. NOTE: The PROCEDURE PRINT printed page 1. NOTE: PROCEDURE PRINT used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 14570 title10; 14571 %let EMEXCEPTIONSTRING=; PERFORMANCE DETAILS 15159 *------------------------------------------------------------*; 15160 * Report: Generation of macros and macro variables; 15161 * To see the code generated, set the EM_DEBUG macro variable to SOURCE or _ALL_; 15162 *------------------------------------------------------------*; 15163 %let EMEXCEPTIONSTRING=; 15164 *------------------------------------------------------------*; 15165 * TRAIN: Report; 15166 *------------------------------------------------------------*; 15167 %let EM_ACTION = TRAIN; 15168 %let syscc = 0; 15169 %macro main; 15170 15171 filename temp catalog 'sashelp.emutil.reporter_macros.source'; 15172 %include temp; 15173 filename temp; 15174 15175 %setProperties; 15176 15177 %if %upcase(&EM_ACTION) = CREATE %then %do; 15178 filename temp catalog 'sashelp.emutil.reporter_create.source'; 15179 %include temp; 15180 filename temp; 15181 15182 %create; 15183 %end; 15184 15185 %else 15186 %if %upcase(&EM_ACTION) = TRAIN %then %do; 15187 15188 filename temp catalog 'sashelp.emutil.reporter_train.source'; 15189 %include temp; 15190 filename temp; 15191 %train; 15192 %end; 15193 15194 %doendm: 15195 %mend main; 15196 15197 %main; NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.REPORTER_MACROS.SOURCE. 15200 +%macro SetProperties; 15202 + /* reporting options */ 15203 + %em_checkmacro(name=EM_PROPERTY_FORMAT, value=PDF , global=Y); 15204 + %em_checkmacro(name=EM_PROPERTY_NODES , value=PATH, global=Y); 15205 + %em_checkmacro(name=EM_PROPERTY_STYLE , value=DEFAULT, global=Y); 15206 + %em_checkmacro(name=EM_PROPERTY_SHOWALL, value=N, global=Y); 15208 + %em_checkmacro(name=EM_PROPERTY_SUMMARIZATION, value=Y, global=Y); 15209 + %em_checkmacro(name=EM_PROPERTY_VARRANKING, value=Y, global=Y); 15210 + %em_checkmacro(name=EM_PROPERTY_CLASSIFICATION, value=Y, global=Y); 15211 + %em_checkmacro(name=EM_PROPERTY_CROSSTABS, value=Y, global=Y); 15212 + %em_checkmacro(name=EM_PROPERTY_LIFTCHART, value=Y, global=Y); 15213 + %em_checkmacro(name=EM_PROPERTY_FITSTAT, value=Y, global=Y); 15214 + %em_checkmacro(name=EM_PROPERTY_COMPAREMDL, value=Y, global=Y); 15216 + %em_checkmacro(name=EM_PROPERTY_BASICOUTPUT, value=N, global=Y); 15218 + %em_checkmacro(name=EM_PROPERTY_textfont, value=Arial, global=Y); 15219 + %em_checkmacro(name=EM_PROPERTY_headersize, value=8, global=Y); 15220 + %em_checkmacro(name=EM_PROPERTY_textsize, value=6, global=Y); 15221 + %em_checkmacro(name=EM_PROPERTY_titlesize, value=10, global=Y); 15223 +%mend SetProperties; NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.REPORTER_TRAIN.SOURCE. 15224 + 15225 +%macro train(); 15226 + 15227 + filename temp catalog 'sashelp.emutil.reporter_trainmacros.source'; %include temp; filename temp; 15228 + filename temp catalog 'sashelp.emrpm.em_modelprops.source'; %include temp; filename temp; 15229 + 15230 + /* Initialize property macro variables */ 15231 + %SetProperties; 15232 + 15233 + /* if pdf or rtf files exist, delete these prior to recreating report */ 15234 + %EM_GETNAME(key=REPORT, type=FILE, extension=pdf); 15235 + filename pdffile "&EM_USER_REPORT"; 15236 + %if %sysfunc(fexist(pdffile)) %then %do; 15237 + %let rc = %sysfunc(fdelete(pdffile)); 15238 + %end; 15239 + filename pdffile; 15240 + 15241 + %EM_GETNAME(key=REPORT, type=FILE, extension=rtf); 15242 + filename rtffile "&EM_USER_REPORT"; 15243 + %if %sysfunc(fexist(rtffile)) %then %do; 15244 + %let rc = %sysfunc(fdelete(rtffile)); 15245 + %end; 15246 + filename rtffile; 15247 + 15248 + /* create report */ 15249 + 15250 + %EM_REPORT_CREATE( 15251 + path = &EM_NODEDIR, 15252 + lib = &EM_LIB, 15253 + startnodeid = &EM_NODEID, 15254 + showall = &EM_PROPERTY_SHOWALL, 15255 + nodes = &EM_PROPERTY_NODES, 15256 + format = &EM_PROPERTY_FORMAT, 15257 + style = &EM_PROPERTY_STYLE 15258 + ); 15259 + 15260 + %if &EMEXCEPTIONSTRING ne %then %do; %goto doendm; %end; 15261 + 15262 + %EM_REPORT_RESULTS( 15263 + path = &EM_NODEDIR, 15264 + lib = &EM_LIB, 15265 + startnodeid = &EM_NODEID, 15266 + showall = &EM_PROPERTY_SHOWALL, 15267 + nodes = &EM_PROPERTY_NODES, 15268 + format = &EM_PROPERTY_FORMAT, 15269 + style = &EM_PROPERTY_STYLE 15270 + ); 15271 + 15272 + %doendm: 15273 + 15274 +%mend train; NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.REPORTER_TRAINMACROS.SOURCE. 15275 +/*---------------------------------------------------------*/ 15276 + * EM_REPORT_CREATE; 15277 + * all work needed to start the documents; 15278 + * - identify directory location; 15279 + * - clear directory of em report files; 15280 + * - initialize document options; 15281 + * - setup ODS system; 15282 +/*---------------------------------------------------------*/ 15283 +%macro EM_REPORT_CREATE( 15284 + path=, /*-- output location ---*/ 15285 + lib=, /*-- em workspace library ---*/ 15286 + startnodeid=, /*-- starting nodeid ---*/ 15287 + showall=, /*-- show all content Y or N ---*/ 15288 + nodes=, /*-- nodes to generate report on ---*/ 15289 + format=, /*-- format for generated report ---*/ 15290 + style= /*--- style for ODS statement ---*/ 15291 +) ; 15293 + filename temp catalog 'sashelp.emutil.reporter_plotmacros.source'; %include temp; filename temp; 15294 + filename temp catalog 'sashelp.emutil.reporter_printmacros.source'; %include temp; filename temp; 15295 + filename temp catalog 'sashelp.emutil.reporter_rpmmacros.source'; %include temp; filename temp; 15296 + filename temp catalog 'sashelp.emutil.em_gettrainpath.source' ; %include temp; filename temp; 15297 + filename temp catalog 'sashelp.emutil.reporter_tagset_template.source'; %include temp; filename temp; 15299 + /*--- 1. set global parameters ---*/ 15301 + %GLOBAL EM_REPORT_PATH ; %let EM_REPORT_PATH = &PATH ; 15302 + %GLOBAL EM_REPORT_SHOWALL ; %let EM_REPORT_SHOWALL = %upcase(&showall) ; 15303 + %GLOBAL EM_REPORT_LIB ; %let EM_REPORT_LIB = &lib; 15304 + %GLOBAL EM_REPORT_NODES ; %let EM_REPORT_NODES = &nodes; 15305 + %GLOBAL EM_REPORT_FORMAT ; %let EM_REPORT_FORMAT = &format; 15306 + %GLOBAL EM_REPORT_SYTLE ; %let EM_REPORT_STYLE = &style; 15308 + /*--- 2. set global constants ---*/ 15310 + %GLOBAL EM_REPORT_GDEVICE; 15311 + %GLOBAL EM_REPORT_PRINT_MAXVARS; 15312 + %GLOBAL EM_REPORT_TEXT_FONT; 15313 + %GLOBAL EM_REPORT_TEXT_SIZE; 15314 + %GLOBAL EM_REPORT_TITLE_SIZE; 15315 + %GLOBAL EM_REPORT_HEADER_SIZE; 15316 + %GLOBAL EM_REPORT_NODE_FONT; 15317 + %GLOBAL EM_REPORT_TITLE; 15318 + %GLOBAL EM_REPORT_FOOTNOTE1; 15319 + %GLOBAL EM_REPORT_FOOTNOTE2; 15321 + %global EM_REPORT_SUPPRESS_DATE; %let EM_REPORT_SUPPRESS_DATE =; 15323 + %global RPM_REPORT_MODELNODE RPM_REPORT_SCORENODE RPM_REPORT_MDLCOMP RPM_REPORT_VALIDSUMMARY; 15325 + %if "&EM_REPORT_GDEVICE" eq "" %then %let EM_REPORT_GDEVICE = GIF; 15326 + %if "&EM_REPORT_PRINT_MAXVARS" eq "" %then %let EM_REPORT_PRINT_MAXVARS= 40; 15327 + %if "&EM_REPORT_TEXT_FONT" eq "" %then %do; 15328 + %let EM_REPORT_TEXT_FONT= %sysfunc(getlocale(FTITLE, &EM_PROPERTY_TEXTFONT)); 15329 + %let EM_REPORT_TEXT_FONT= %sysfunc(tranwrd(&EM_REPORT_TEXT_FONT,%str(),%str())); 15330 + %end; 15331 + %if "&EM_REPORT_NODE_FONT" eq "" %then %do; 15332 + %let EM_REPORT_NODE_FONT = %sysfunc(getlocale(FTITLE, SIMPLEX)) ; 15333 + %let EM_REPORT_NODE_FONT = %sysfunc(tranwrd(&EM_REPORT_NODE_FONT,%str(),%str())); 15334 + %end; 15335 + %if "&EM_REPORT_HEADER_SIZE" eq "" %then %let EM_REPORT_HEADER_SIZE = &EM_PROPERTY_HEADERSIZE; 15336 + %if "&EM_REPORT_TEXT_SIZE" eq "" %then %let EM_REPORT_TEXT_SIZE = &EM_PROPERTY_TEXTSIZE; 15337 + %if "&EM_REPORT_TITLE_SIZE" eq "" %then %let EM_REPORT_TITLE_SIZE = &EM_PROPERTY_TITLESIZE; 15339 + /*--- 3. text for title statements ---*/ 15341 + %global EM_REPORT_PROJECT_TEXT ; %let EM_REPORT_PROJECT_TEXT= %superq(EM_PROJECTNAME); 15342 + %global EM_REPORT_DIAGRAM_TEXT ; %let EM_REPORT_DIAGRAM_TEXT= %superq(EM_WSNAME); 15344 + %EM_REPORT_NODE_TEXT(&startnodeid) ; 15346 + /*--- 4. create output filename ---*/ 15348 + %EM_REGISTER(key=REPORT, type=FILE, extension=&EM_REPORT_FORMAT); 15350 + /*--- 5. Allways get the path for showing the score code --*/ 15352 + %let FLOW= ; /*--- ignore for now ---*/ 15353 + %let PUBLISH=; /*--- ignore for now ---*/ 15354 + %let EM_LIB=&lib ; /*--- used by the macro */ 15356 + %if &EM_REPORT_NODES ne SUMMARY %then %do; 15357 + %EM_PATH(nodeid=&startnodeid, outds=emreportpath, nodes=&EM_REPORT_NODES); 15358 + %end; 15359 + %else %do; 15360 + %EM_PATH(nodeid=&startnodeid, outds=emreportpath, nodes=PATH); 15361 + %end; 15363 + data emreportpath; 15364 + set emreportpath; 15365 + rename nodelabel=nodeid; 15366 + nodeIndex = _n_; 15367 + run; 15369 + /*--- 6. create new tagset templates needed for tree, icicle and pie charts */ 15371 + *** create new style template to address fonts in ods text; 15373 + ods path(prepend) work.templat(update); 15374 + proc template ; 15375 + define style styles.em_style / store=work.templat; 15376 + parent= styles.&EM_REPORT_STYLE; 15378 + style usertext from usertext / 15379 + foreground=black font_size=&EM_REPORT_TITLE_SIZE pt font_face="&EM_REPORT_TEXT_FONT" font_weight=bold 15380 + ; 15381 + style systemtitle from systemtitle / 15382 + color=colors("systitlefg") backgroundcolor=colors("systitlebg") 15383 + fontsize=&EM_REPORT_TITLE_SIZE pt font_face="&EM_REPORT_TEXT_FONT" font_weight=bold 15384 + ; 15385 + style systemfooter from systemfooter / 15386 + color=colors("systitlefg") backgroundcolor=colors("systitlebg") 15387 + font_face="&EM_REPORT_TEXT_FONT" 15388 + ; 15389 + style GraphFonts from GraphFonts / 15390 + 'GraphTitleFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TITLE_SIZE pt) 15391 + 'GraphTitle1Font' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TITLE_SIZE pt) 15392 + 'GraphLabelFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_HEADER_SIZE pt) 15393 + 'GraphFootnoteFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15394 + 'GraphValueFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15395 + 'GraphDataFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15396 + ; 15397 + style Fonts from Fonts/ 15398 + 'TitleFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TITLE_SIZE pt) 15399 + 'TitleFont2' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TITLE_SIZE pt) 15400 + 'StrongFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15401 + 'EmphasisFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15402 + 'headingFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15403 + 'headingEmphasisFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15404 + 'FixedEmphasisFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15405 + 'FixedStrongFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15406 + 'FixedHeadingFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15407 + 'FixedFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15408 + 'BatchFixedFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15409 + 'docFont' = ("&EM_REPORT_TEXT_FONT", &EM_REPORT_TEXT_SIZE pt) 15410 + ; 15411 + style GraphTitleText from GraphTitleText / font_face="&EM_REPORT_TEXT_FONT"; 15412 + style data from data / font_size=&EM_REPORT_TEXT_SIZE pt; 15413 + style header from header / font_size=&EM_REPORT_HEADER_SIZE pt; 15414 + style rowheader from header; 15415 + end; 15416 + run; quit; 15418 + /*--- 7. start report / destination configurations ---*/ 15420 + *** options for page layout; 15421 + options nodate nocenter number ls=97 ; 15423 + *** get file name; 15424 + %EM_GETNAME(key=REPORT, type=FILE, extension=&EM_REPORT_FORMAT); 15425 + %let file = &EM_USER_REPORT; 15427 + *** turn off LISTING and turn on the specified destination; 15428 + ods listing close; 15429 + ods graphics / height=4.5in; 15430 + ods &EM_REPORT_FORMAT file="&file" style=styles.em_style 15431 + %if &EM_REPORT_FORMAT eq PDF %then %do; startpage=NO uniform NOTOC %end; 15432 + %if &EM_REPORT_FORMAT eq RTF %then %do; startpage=NEVER BODYTITLE %end; 15433 + ; 15435 + *** titles and footnotes; 15436 + ods &EM_REPORT_FORMAT text=" "; 15437 + %if "&EM_REPORT_TITLE" ne "" %then %do; 15438 + ods &EM_REPORT_FORMAT text="&EM_REPORT_TITLE"; 15439 + %end; 15440 + %else %do; 15441 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; 15442 + %end; 15444 + %if "&EM_REPORT_FOOTNOTE1" ne "" %then %do; footnote1 "&EM_REPORT_FOOTNOTE1"; %end; 15445 + %if "&EM_REPORT_FOOTNOTE2" ne "" %then %do; footnote2 "&EM_REPORT_FOOTNOTE2"; %end; 15447 + /*--- 8. verify that valid flow exists for SUMMARY (RPM) report ---*/ 15448 + /*--- if not, SUMMARY style report can not be generated and PATH report will be done instead ---*/ 15450 + %EM_REPORT_validSummaryPath(startNodeID = &startNodeID); 15452 + %if ((&EM_REPORT_NODES eq SUMMARY ) AND(&RPM_REPORT_VALIDSUMMARY eq 1))%then %do; 15453 + %local hprpm_hpassess; 15454 + %let hprpm_hpassess = &em_lib..&RPM_REPORT_MODELNODE._hpassess; 15455 + %if %sysfunc(exist(&hprpm_hpassess)) %then %do; 15456 + filename temp catalog 'sashelp.hpdm.hpdm_scorecard.source'; %include temp; filename temp; 15457 + %EM_REPORT_SUMMARY(runHP=1); 15458 + %end; 15459 + %else %do; 15460 + %EM_REPORT_SUMMARY(runHP=0); 15461 + %end; 15462 + %goto create_endline; 15463 + %end; 15464 + %else %do; 15465 + %if &EM_REPORT_NODES eq SUMMARY %then %let EM_REPORT_NODES= PATH; 15466 + %end; 15468 + /*--- 9. output report information (header of the report)---*/ 15470 + ods proclabel "%sysfunc(sasmsg(sashelp.dmine, rpt_reportinfo_title, NOQUOTE))"; 15471 + data _null_; 15472 + call symput('report_date', %nrbquote(strip(put(date(), NLDATE.)))); 15473 + call symput('report_time', %nrbquote(strip(put(datetime(), NLTIME.)))); 15474 + run; 15476 + data _null_; 15477 + file print ; 15478 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_user_note, NOQUOTE, &sysuserid))" ; 15479 + %if ((&EM_REPORT_SUPPRESS_DATE eq ) OR (%index(&EM_REPORT_SUPPRESS_DATE, Y) < 1)) %then %do; 15480 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_date_note, NOQUOTE, %nrbquote(&report_time), &report_date))" ; 15481 + %end; 15482 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_project_note, NOQUOTE, &EM_REPORT_PROJECT_TEXT)) " ; 15483 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_diagram_note, NOQUOTE, %nrstr(&EM_REPORT_DIAGRAM_TEXT)))" / ; 15484 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_startnode_note, NOQUOTE, &startnodeid))"; 15485 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_nodelabel_note, NOQUOTE, %nrbquote(&em_report_node_text)))" ; 15486 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_nodes_note, NOQUOTE, &EM_REPORT_NODES))" ; 15487 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_showall_note, NOQUOTE, &EM_REPORT_showall))" /; 15488 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_format_note, NOQUOTE, &EM_REPORT_FORMAT))" ; 15489 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_style_note, NOQUOTE, &EM_REPORT_STYLE))" /; 15490 + run ; 15492 + /*--- 10. generate the workspace plot ---*/ 15494 + %em_report_workspace_xml; 15495 + %em_getname(key=PFD, type=FILE, extension=XML); 15496 + %em_report_makeds(&EM_USER_PFD, xmldata); 15497 + %em_report_workspace_render; 15499 + /*--- 11. identify the nodes to report ---*/ 15500 + /*--- merged and modified from three previous macros: ---*/ 15501 + /*--- EM_REPORT_PATH, EM_REPORT_PREDECESORS EM_REPORT_PREDECESORS_COUNT ---*/ 15503 + %global EM_REPORT_NODENUM EM_REPORT_NODELIST; 15504 + %let EM_REPORT_NODENUM = 0; 15506 + %if &EM_REPORT_NODES eq PATH or &EM_REPORT_NODES eq ALL 15507 + %then %do; 15508 + %if %sysfunc(exist(emreportpath)) %then %do; 15509 + proc sql noprint; 15510 + select count(*) into :EM_REPORT_NODENUM 15511 + from emreportpath where nodeID ne " "; 15512 + %if &EM_REPORT_NODENUM gt 0 %then %do; 15513 + select strip(nodeID) into :EM_REPORT_NODELIST separated by ' ' 15514 + from emreportpath where nodeID ne " " order by nodeIndex; 15515 + %end; 15516 + quit; 15517 + %end; 15518 + %end; 15519 + %else %if &EM_REPORT_NODES eq PREDECESSOR 15520 + %then %do ; 15521 + proc sql noprint; 15522 + select count(*) into :EM_REPORT_NODENUM 15523 + from &EM_REPORT_LIB..em_dgraph where upcase(strip(to)) eq upcase(strip("&startnodeid")); 15524 + %if &EM_REPORT_NODENUM gt 0 %then %do; 15525 + select strip(from) into :EM_REPORT_NODELIST separated by ' ' 15526 + from &EM_REPORT_LIB..em_dgraph where upcase(strip(to)) eq upcase(strip("&startnodeid")); 15527 + %end; 15528 + quit; 15529 + %end; 15530 + %else %if &EM_REPORT_NODES eq 0 %then %do; 15531 + %let EM_REPORT_NODENUM = 1; 15532 + %let EM_REPORT_NODELIST = &startnodeid; 15533 + %end; 15535 + %if &EM_REPORT_NODENUM gt 0 %then %do; 15536 + %do n = 1 %to &EM_REPORT_NODENUM; 15537 + %EM_REPORT_NODE(nodeid=%scan(&EM_REPORT_NODELIST,&n,' ')); 15538 + %end; 15539 + %end; 15541 + /*--- 12. close report and ODS destinations---*/ 15543 + %create_endline:; 15545 + data _NULL_ ; 15546 + file print; 15547 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_endreport_note, NOQUOTE))" ; 15548 + run; 15550 + title1; title2; title3 ; 15551 + %if "&EM_REPORT_FOOTNOTE1" ne "" %then %do; footnote1; %end; 15552 + %if "&EM_REPORT_FOOTNOTE2" ne "" %then %do; footnote2; %end; 15553 + ods graphics / reset=height; 15554 + ods listing; 15555 + ods &EM_REPORT_FORMAT close; 15557 +%mend EM_REPORT_CREATE ; 15559 +/*---------------------------------------------------------*/ 15560 + * EM_REPORT_NODE ; 15561 + * create a report for a node on an EM diagram ; 15562 +/*---------------------------------------------------------*/ 15563 +%macro EM_REPORT_NODE(nodeid=) ; 15565 + %if not %sysfunc(exist(&em_report_lib..&nodeid._emreport)) 15566 + %then %do ; 15567 + %put NOTE: Node report data set (&em_report_lib..&nodeid._emreport) is not defined.; 15568 + %goto node_skip; 15569 + %end ; 15571 + /*--- 1. set global parameters ---*/ 15573 + %global EM_REPORT_NODEID EM_REPORT_KEY_WHERECLAUSE 15574 + EM_REPORT_TTL1 EM_REPORT_TTL2 EM_REPORT_TTL3 15575 + ; 15576 + %let EM_REPORT_NODEID= &nodeid ; 15578 + /*--- 2. preparations: Node Text; Path; Notes; Num of Prev. Nodes ---*/ 15580 + /* 2.1 get node text;*/ 15581 + %EM_REPORT_NODE_TEXT(&nodeid) ; 15583 + /* 2.2 get the em path to this node;*/ 15584 + %EM_gettrainpath(nodeid=&nodeid,outpath=_tmp_emrnp); 15586 + %if %sysfunc(exist(_tmp_emrnp)) 15587 + %then %do; 15588 + data _null_; 15589 + set _tmp_emrnp end=eof ; 15590 + length path $1000 ; 15591 + retain path ' '; 15592 + if _n_ eq 1 15593 + then path = strip(nodelabel) ; 15594 + else path = strip(path) !! " => " !! strip(nodelabel); 15595 + if eof then call symput('print_path', strip(path)); 15596 + run; 15597 + %end ; 15598 + %else %do; 15599 + %let print_path= Unknown; 15600 + %end ; 15602 + /* 2.3 retrieve location of notes file;*/ 15603 + %let temp = %nrbquote(%sysfunc(pathname(&EM_REPORT_LIB))); 15604 + %let path = %nrbquote(%sysfunc(tranwrd(&temp, %str(%"),""))); 15605 + %let file = EMNOTES.txt; 15606 + %let notesfile = %nrbquote(&path&em_dsep&nodeid&em_dsep&file); 15608 + /* 2.4 predecessor node counts */ 15609 + proc sql noprint; 15610 + select count(*) into :EM_REPORT_PREDECESSORS_COUNT 15611 + from &EM_REPORT_LIB..EM_DGRAPH where upcase(strip(to)) eq upcase(strip("&nodeid")); 15612 + quit; 15614 + %if ((&EM_REPORT_PREDECESSORS_COUNT eq 0) or (&EM_REPORT_NODES eq 0) or (&EM_REPORT_NODES eq PREDECESSOR)) 15615 + %then %let varlist=1; 15616 + %else %let varlist=0; 15618 + %if %substr(%upcase(%sysfunc(strip(&nodeid))), 1, 7) eq MDLCOMP 15619 + %then %let varlist = 0; 15621 + /*--- 3. beginning section of a node report ---*/ 15623 + /* 3.1 force page break at the beginning of each node */ 15625 + /* sample output of a beginning section 15626 + ----------------------------------- 15627 + - SAS Enterprise Miner Report - 15628 + - - 15629 + - Node=Regression - 15630 + - Summary - 15631 + - - 15632 + - Node id = Reg - 15633 + - Node label = Regression - 15634 + - Meta Path = Ids => Part => Reg - 15635 + - Notes = - 15636 + -----------------------------------*/ 15638 + ods &EM_REPORT_FORMAT startpage=now; 15640 + ods &EM_REPORT_FORMAT text=" "; 15641 + %if "&EM_REPORT_TITLE" ne "" 15642 + %then %do; ods &EM_REPORT_FORMAT text= "&EM_REPORT_TITLE"; %end; 15643 + %else %do; ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; %end; 15645 + ods &EM_REPORT_FORMAT text=" "; 15646 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text)))"; 15647 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_summary_title, NOQUOTE))"; 15649 + data _null_ ; 15650 + file print; 15651 + put " "; 15652 + %let note = %sysfunc(sasmsg(sashelp.dmine, rpt_rptnodeid_vlabel, NOQUOTE, &nodeid)); put "¬e"; 15653 + %let note = %sysfunc(sasmsg(sashelp.dmine, rpt_rptnodelbl_vlabel, NOQUOTE, %nrbquote(&em_report_node_text))); put "¬e"; 15654 + %let note = %sysfunc(sasmsg(sashelp.dmine, rpt_rptmetapath_vlabel, NOQUOTE, &print_path)); put "¬e"; 15655 + %let note = %sysfunc(sasmsg(sashelp.dmine, rpt_rptnotes_vlabel, NOQUOTE)); put "¬e"; 15656 + put " "; 15657 + run; 15659 + %if "¬esfile" ne "" %then %do; 15660 + filename x "¬esfile" encoding='utf-8' NOBOM; 15661 + data _null_; 15662 + length string $1000; 15663 + file PRINT; 15664 + fid = fopen('x'); 15665 + do while (^fread(fid)); 15666 + rc= fget(fid, string, frlen(fid)); 15667 + string = tranwrd(string, "'", "''"); 15668 + if string eq '' then string = ' '; 15669 + put string; 15670 + end; 15671 + fid = fclose(fid); 15672 + put " "; 15673 + run; 15674 + filename x; 15675 + %end; 15677 + /*--- 4. property table of a node report ---*/ 15678 + %EM_REPORT_PROPERTIES(catalog=&em_report_lib..&nodeid, dsname=properties); 15680 + /*--- 5. datasource table of a node report ---*/ 15681 + %if &varlist eq 1 and %sysfunc(exist(&EM_REPORT_LIB..&EM_REPORT_NODEID._EMTMETADEFAULT)) %then %do; 15682 + %EM_REPORT_DATASOURCE; 15683 + %end; 15685 + /*--- 6. varlist table of a node report ---*/ 15686 + %EM_REPORT_VARS(varlist=&varlist) ; 15688 + /* --- 7. the itemized output of EMREPORT TLFs ---*/ 15690 + /* 7.1 get number of items */ 15691 + proc sql noprint; 15692 + select max(ID) into: numitems from &em_report_lib..&nodeid._emreport; 15693 + quit; 15695 + /* 7.2 define and initialize global KEYs */ 15696 + proc sql noprint; 15697 + select count(distinct key) into :allnumkeys 15698 + from &em_report_lib..&nodeid._emreport; 15699 + select distinct key into :allnamekey1-:allnamekey%left(&allnumkeys) 15700 + from &em_report_lib..&nodeid._emreport; 15701 + quit; 15703 + %do i = 1 %to &allnumkeys; 15704 + %global EM_REPORT_KEY_&&&allnamekey&i; 15705 + %let EM_REPORT_KEY_&&&allnamekey&i = ; 15706 + %end; 15707 + %global EM_REPORT_KEY_YREF EM_REPORT_KEY_XREF EM_REPORT_KEY_Y EM_REPORT_KEY_Y2 EM_REPORT_KEY_X 15708 + EM_REPORT_KEY_LATTICEY EM_REPORT_KEY_LATTICEX EM_REPORT_KEY_WHERE EM_REPORT_KEY_SUBGROUP 15709 + EM_REPORT_KEY_FREQUENCY EM_REPORT_KEY_GROUP EM_REPORT_KEY_Y2REF EM_REPORT_KEY_LATTICETYPE 15710 + EM_REPORT_KEY_ORIENTATION 15711 + ; 15712 + %let EM_REPORT_KEY_AUTODISPLAY = N; 15713 + %let EM_REPORT_KEY_XREF = ; 15714 + %let EM_REPORT_KEY_YREF = ; 15715 + %let EM_REPORT_KEY_Y2REF = ; 15716 + %let EM_REPORT_KEY_X = ; 15717 + %let EM_REPORT_KEY_Y = ; 15718 + %let EM_REPORT_KEY_Y2 = ; 15719 + %let EM_REPORT_KEY_LATTICEX = ; 15720 + %let EM_REPORT_KEY_LATTICEY = ; 15721 + %let EM_REPORT_KEY_WHERE = ; 15722 + %let EM_REPORT_KEY_SUBGROUP = ; 15723 + %let EM_REPORT_KEY_FREQUENCY = ; 15724 + %let EM_REPORT_KEY_GROUP = ; 15725 + %let EM_REPORT_KEY_LATTICETYPE = ; 15726 + %let EM_REPORT_KEY_ORIENTATION = ; 15728 + /* 7.3 loop over items in the EM_REPORT dataset */ 15730 + %do index = 1 %to &numitems ; 15732 + /* 7.3.1 initialize all key macro variables for each item */ 15734 + %do i = 1 %to &allnumkeys; 15735 + %let EM_REPORT_KEY_&&&allnamekey&i = ; 15736 + %end; 15737 + %let EM_REPORT_KEY_AUTODISPLAY = N; 15738 + %let EM_REPORT_KEY_WHERE = ; 15739 + %let EM_REPORT_KEY_WHERECLAUSE = ; 15740 + %let EM_REPORT_TTL1 = ; 15741 + %let EM_REPORT_TTL2 = ; 15742 + %let EM_REPORT_TTL3 = ; 15743 + %let EM_REPORT_KEY_XREF = ; 15744 + %let EM_REPORT_KEY_YREF = ; 15745 + %let EM_REPORT_KEY_Y2REF = ; 15746 + %let EM_REPORT_KEY_X = ; 15747 + %let EM_REPORT_KEY_Y = ; 15748 + %let EM_REPORT_KEY_Y2 = ; 15749 + %let EM_REPORT_KEY_LATTICEX = ; 15750 + %let EM_REPORT_KEY_LATTICEY = ; 15751 + %let EM_REPORT_KEY_SUBGROUP = ; 15752 + %let EM_REPORT_KEY_FREQUENCY = ; 15753 + %let EM_REPORT_KEY_GROUP = ; 15754 + %let EM_REPORT_KEY_LATTICETYPE = ; 15755 + %let EM_REPORT_KEY_ORIENTATION = ; 15757 + %let item_skip_code = 1; 15759 + data _null_; 15760 + set &em_report_lib..&nodeid._emreport(where=(id eq &index)); 15761 + call symput("EM_REPORT_KEY_"!!strip(upcase(key)), strip(value)); 15762 + run; 15764 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "MULTIPLESCATTER" 15765 + %then %let EM_REPORT_KEY_VIEWTYPE = SCATTER; 15767 + /* special treatment for EM_REPORT_KEY_Y in overlaid line plot */ 15768 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "PLOT" or "&EM_REPORT_KEY_VIEWTYPE" eq "SCATTER" 15769 + or "&EM_REPORT_KEY_VIEWTYPE" eq "LINEPLOT" 15770 + or "&EM_REPORT_KEY_LATTICETYPE" eq "LINEPLOT" or "&EM_REPORT_KEY_LATTICETYPE" eq "PLOT" 15771 + %then %do; 15772 + proc sql noprint; 15773 + select distinct value into :EM_REPORT_KEY_Y separated by ' ' 15774 + from &em_report_lib..&nodeid._emreport(where=(id eq &index)) 15775 + where upcase(key) eq "Y"; 15776 + quit; 15777 + %end; 15779 + %put ==&INDEX : Viewtype = &EM_REPORT_KEY_VIEWTYPE &EM_REPORT_KEY_DESCRIPTION ; 15781 + /* 7.3.2 set EM_REPORT_KEY_WHERE as EM_REPORT_KEY_WHERECLAUSE */ 15783 + %if "&EM_REPORT_KEY_WHERECLAUSE" ne "" and "&EM_REPORT_KEY_WHERE" eq "" 15784 + %then %do; 15785 + %let EM_REPORT_KEY_WHERE = %str(&EM_REPORT_KEY_WHERECLAUSE); 15786 + %end; 15787 + %else %if "&EM_REPORT_KEY_WHERECLAUSE" eq "" and "&EM_REPORT_KEY_WHERE" ne "" 15788 + %then %do; 15789 + %let EM_REPORT_KEY_WHERE = %str(&EM_REPORT_KEY_WHERE); 15790 + %end; 15791 + %else %do; 15792 + %let EM_REPORT_KEY_WHERE = ; 15793 + %end; 15795 + %if "&EM_REPORT_KEY_WHERE" ne "" %then %do; 15796 + %let EM_REPORT_KEY_WHERECLAUSE = %str((where=(&EM_REPORT_KEY_WHERE))); 15797 + %end; 15799 + /* 7.3.3 skip this TLF item if the source data set does not exist */ 15800 + %if not %sysfunc(exist(&EM_REPORT_LIB..&EM_REPORT_KEY_FILE)) %then %do; 15801 + %let item_skip_code = 0; 15802 + %end; 15804 + /* 7.3.4 skip the TLF item as documented in the previous version of the macro */ 15805 + /* or just print the TLF item as documented, or use special macros */ 15807 + data _null_; 15808 + format type $100. desc $200.; 15809 + type = strip(upcase(symget('EM_REPORT_KEY_VIEWTYPE'))); 15810 + desc = strip(upcase(symget('EM_REPORT_KEY_DESCRIPTION'))); 15812 + if (type in ('SCATTER') and desc in ('STATPLOT' 'RULEPATHITEM' 'RULEPATHSTAT' 'CONFPLOT' 'INPUTMEAN')) 15813 + or (type in ('PLOT') and desc in ('SEASON' 'TREND' 'CORRSTAT' 'DECOMP')) 15814 + or (type in ('HISTOGRAM') and desc in ('WEIGHT' 'MAP' 'ESTIMATEGRID' 'CROSSCCFMAP' 'CROSSCCFNORMMAP')) 15815 + or (type in ('BAR') and desc in ('VIP' 'ABSESTIMATE' 'ABSSTDESTIMATE' 'PRINCOEFFPLOT')) 15816 + or (type in ('LATTICE') and desc in ('ESTIMATEGRID' 'ASSESSRANKGRID' 'CORRPLOT')) 15817 + then call symput('item_skip_code','2'); 15819 + /* ASSESSRANKGRID : content handled in %EM_REPORT_PLOT - from old macro comments*/ 15820 + /* CORRPLOT: empty macro report_corrplot in old macro */ 15822 + if (type in ('HISTOGRAM') and desc in ('CLUSCORR' 'VARCORR')) 15823 + or (type in ('BAR') and desc in ('ESTIMATE' 'CORRSTRUCT' 'FITSTATPLOT')) 15824 + or (type in ('LATTICE') and desc in ('CHIPLOT' 'WORTH')) 15825 + then call symput('item_skip_code','3'); 15827 + if (type in ('PLOT') and desc in ('ASSESSRANKOVERLAY')) 15828 + then call symput('item_skip_code','4'); 15829 + if (type in ('LATTICE') and desc in ('ASSESSRANKOVERLAY')) 15830 + then call symput('item_skip_code','5'); 15832 + if (type in ('PLOT') and desc in ('EVENTPLOT')) 15833 + then call symput('item_skip_code','6'); 15835 + if (type in ('LATTICE') and desc in ('CLASSSTAT')) 15836 + then call symput('EM_REPORT_KEY_VIEWTYPE','DATA'); 15838 + if (type in ('LATTICE') and desc in ('ASSESSSCOREDIST')) 15839 + then call symput('item_skip_code','7'); 15840 + if (type in ('LATTICE') and desc in ('SCOREDIST')) 15841 + then call symput('item_skip_code','8'); 15842 + if (type in ('LATTICE') and desc in ('CLASSIFICATIONMANY')) 15843 + then call symput('item_skip_code','9'); 15845 + if (type in ('PLOT') and desc in ('HPDMASSESS')) 15846 + then call symput('item_skip_code','10'); 15848 + if (type in ('HISTOGRAM') and desc in ('HPWEIGHTS' 'BELIEFS BY VALUE' 'TSDISTANCEMAP')) 15849 + then call symput('item_skip_code','11'); 15851 + run; 15853 + /* 7.3.5 */ 15855 + %EM_REPORT_GTT; 15857 + /********** actions by item_skip_code ***********************************/ 15859 + %if &item_skip_code eq 2 %then %do; 15860 + /* TLF is skipped for these types of reports */ 15861 + %end; 15862 + %else 15863 + %if &item_skip_code eq 3 %then %do; 15864 + %if (("&EM_REPORT_KEY_AUTODISPLAY" eq "Y") OR ("&EM_REPORT_SHOWALL" eq "Y")) %then %do; 15865 + /* just a print */ 15866 + title1 "&EM_REPORT_TTL1"; 15867 + title2 "&EM_REPORT_TTL2"; 15868 + title3 "&EM_REPORT_TTL3"; 15869 + ods proclabel = "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text))) %sysfunc(sasmsg(sashelp.dmine, views_descriptions_&em_report_key_description, NOQUOTE))"; 15870 + proc print data=&EM_REPORT_LIB..&EM_REPORT_KEY_FILE noobs label contents=''; 15871 + run; 15872 + %end; 15873 + %end; 15874 + %else 15875 + %if &item_skip_code eq 4 %then %do; 15876 + %EM_REPORT_EMRANK(pdat=&em_report_lib..&EM_REPORT_KEY_FILE,lattice=no); 15877 + %end; 15878 + %else 15879 + %if &item_skip_code eq 5 %then %do; 15880 + %EM_REPORT_EMRANK(pdat=&em_report_lib..&EM_REPORT_KEY_FILE,lattice=yes); 15881 + %end; 15882 + %else 15883 + %if &item_skip_code eq 6 %then %do; 15884 + %EM_REPORT_EVENTPLOT; 15885 + %end; 15886 + %else 15887 + %if &item_skip_code eq 7 %then %do; 15888 + %if %substr(%upcase(%sysfunc(strip(&nodeid))),1,7) ne MDLCOMP or &EM_REPORT_NODES eq PREDECESSOR %then %do; 15889 + %EM_REPORT_SCOREDIST; 15890 + %end; 15891 + %end; 15892 + %else 15893 + %if &item_skip_code eq 8 %then %do; 15894 + %EM_REPORT_SCOREDIST2; 15895 + %end; 15896 + %else 15897 + %if &item_skip_code eq 9 %then %do; 15898 + %if (("&EM_REPORT_KEY_AUTODISPLAY" eq "Y") OR ("&EM_REPORT_SHOWALL" eq "Y")) %then %do; 15899 + %EM_REPORT_CLASSIFYTAB; 15900 + %end; 15901 + %end; 15902 + %else 15903 + %if &item_skip_code eq 10 %then %do; 15904 + %if (("&EM_REPORT_KEY_AUTODISPLAY" eq "Y") OR ("&EM_REPORT_SHOWALL" eq "Y")) %then %do; 15905 + %EM_REPORT_HPDMASSESS; 15906 + %end; 15907 + %end; 15908 + %else 15909 + %if &item_skip_code eq 11 %then %do; 15910 + %EM_REPORT_HEATMAPTEMPLATE; 15911 + %end; 15914 + %else 15916 + %if &item_skip_code eq 1 %then %do; 15918 + /*--- process the viewtypes ---*/ 15919 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "PLOT" %then %do; %EM_REPORT_SGPLOT(type=PLOT); %end; 15920 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "LINEPLOT" %then %do; %EM_REPORT_SGPLOT(type=LINEPLOT); %end; 15921 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "SCATTER" %then %do; %EM_REPORT_SGPLOT(type=SCATTER); %end; 15922 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "BAR" %then %do; %EM_REPORT_SGPLOT(type=BARPLOT); %end; 15923 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "HISTOGRAM" %then %do; %EM_REPORT_SGPLOT(type=HISTOGRAM);%end; 15924 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "PIE" %then %do; %EM_REPORT_SGSILK(type=PIE); %end; 15925 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "DTREE" %then %do; %EM_REPORT_SGSILK(type=DTREE); %end; 15926 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "ICICLE" %then %do; %EM_REPORT_SGSILK(type=ICICLE); %end; 15927 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "DENDROGRAM" %then %do; %EM_REPORT_DENDROGRAM; %end; 15928 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "ITERATIONPLOT" %then %do; %EM_REPORT_ITERATIONPLOT; %end; 15929 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "DATA" %then %do; %EM_REPORT_DATA(maxobs=100); %end; 15930 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "MULTIPLEY2PLOT" %then %do; %EM_REPORT_MULTIPLY2PLOT; %end; 15932 + %if "&EM_REPORT_KEY_VIEWTYPE" eq "LATTICE" %then %do; 15933 + ods graphics / height=9in; 15934 + %EM_REPORT_LATTICE; 15935 + ods graphics / height=4.5in; 15936 + %end; 15937 + %end; 15939 + title1; title2; title3; title4; title5; 15940 + %end; 15942 +%node_skip: 15944 +%mend EM_REPORT_NODE; 15946 +/*---------------------------------------------------------*/ 15947 +/*---- create xml file containing pfd information ----*/ 15948 +/*---------------------------------------------------------*/ 15949 +%macro em_report_workspace_xml(); 15951 + %global EM_REPORT_LIB; 15953 + %EM_REGISTER(key=PFD, type=FILE, extension=XML); 15954 + %EM_GETNAME(key=PFD, type=FILE, extension=XML); 15956 + filename x "&EM_USER_PFD" encoding="utf-8" NOBOM; 15958 + /* Node information */ 15959 + data _null_; 15960 + file x; 15961 + set &EM_REPORT_LIB..EM_NODEID; 15962 + length string $400; 15964 + /* check for invalid characters in the node label */ 15965 + label = tranwrd(label, %nrstr("&"), %nrstr("&")); 15966 + label = tranwrd(label, %nrstr("<"), %nrstr("<")); 15967 + label = tranwrd(label, %nrstr(">"), %nrstr(">")); 15968 + label = tranwrd(label, %nrstr("'"), %nrstr("'")); 15969 + label = tranwrd(label, %nrstr('"'), %nrstr('"')); 15971 + string = cats(''); 15972 + put string; 15973 + run; 15975 + /* Link information */ 15976 + data _null_; 15977 + file x mod; 15978 + set &EM_REPORT_LIB..EM_DGRAPH(where=(TO ne "")); 15979 + length string $400; 15981 + string = cats(""); 15982 + put string; 15983 + run; 15985 + filename x; 15987 +%mend em_report_workspace_xml; 15989 +/*---------------------------------------------------------*/ 15990 +/* "chop" xml definitions, wrapping if over 256 bytes */ 15991 +/*---------------------------------------------------------*/ 15992 +%macro em_report_makeds(XMLfile,outds); 15994 + %local rc fileref fid max reclen; 15995 + %let fileref=xmlref; 15996 + %if %sysfunc(fexist(xmlref)) %then %put ERROR: Fileref XMLREF in use.; 15997 + %else %do; 15998 + %let rc=%sysfunc(filename(fileref,&XMLfile,,encoding='utf-8'))); 15999 + %if %sysfunc(fileref(xmlref)) ne 0 %then %put %sysfunc(sysmsg()); 16000 + %else %do; 16001 + %let fid=%sysfunc(fopen(xmlref,i,5000,v)); 16002 + %let max=0; 16003 + %if %sysfunc(fread(&fid)) = 0 %then %do; 16004 + %let reclen=%sysfunc(frlen(&fid)); 16005 + %let max=&reclen; 16006 + %do %while(%sysfunc(fread(&fid)) = 0); 16007 + %let reclen=%sysfunc(frlen(&fid)); 16008 + %if &reclen > &max %then %let max=&reclen; 16009 + %end; 16010 + %end; 16011 + %let rc=%sysfunc(fclose(&fid)); 16013 + data &outds(keep=PFDItemList); 16014 + infile xmlref recfm=v lrecl=&max length=len; 16015 + length PFDItemList $256; 16016 + input record $varying5000. len; 16017 + recordNum+1; 16018 + do start=1 to len by 256 ; 16019 + end=start+256; 16020 + *put recordNum= start= end=; 16021 + PFDItemList=substr(record,start,end); 16022 + output; 16023 + end; 16024 + run; 16025 + %let rc=%sysfunc(filename(fileref)); 16026 + %end; 16027 + %end; 16028 +%mend em_report_makeds; 16030 +/*---------------------------------------------------------*/ 16031 +/* render a workspace plot in the ODS destination */ 16032 +/*---------------------------------------------------------*/ 16033 +%macro em_report_workspace_render; 16035 + /*--- determine if flow was run in batch (ie all x/y coordinates are -1) ---*/ 16036 + %let runBatch = 0; 16037 + data temp; 16038 + set &EM_REPORT_LIB..EM_NODEID; 16039 + if X = -1 AND Y= - 1 then delete; 16040 + run; 16041 + %let dsid = %sysfunc(open(work.temp)); 16042 + %let nobs = %sysfunc(ATTRN(&dsid, NOBS)); 16043 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 16045 + %if &nobs le 1 %then %let runBatch = 1; 16047 + title1; title2; title3; 16049 + %let temp = %nrbquote(%sysfunc(PATHNAME(&em_report_lib))); 16050 + %let path = %nrbquote(%sysfunc(tranwrd(&temp, %str(%"),""))); 16051 + %let view = view.xml; 16052 + %let viewfile = %nrbquote(&path&em_dsep&EM_NODEID&em_dsep&view); 16053 + %let datax = data.xml; 16054 + %let dataxfile = %nrbquote(&path&em_dsep&EM_NODEID&em_dsep&datax); 16056 + /* make sgDataModel*/ 16057 + ods &EM_REPORT_FORMAT exclude SGRENDER; /* disable sgrender output to PDF */ 16058 + ods tagsets.gtl file="&viewfile" data="&dataxfile" encoding="utf-8" style=styles.em_style; 16059 + proc sgrender data=work.xmldata template=dataonly; 16060 + dynamic var1="PFDItemList"; 16061 + run; 16063 + /* pfd event code */ 16064 + %if "&EM_REPORT_TITLE" ne "" %then %do; 16065 + ods tagsets.gtl event=LayoutRegion(start) 16066 + options(title ="&EM_REPORT_TITLE" 16067 + title2="%sysfunc(sasmsg(sashelp.dmine, rpt_processflow_title, NOQUOTE))"); 16068 + %end; 16069 + %else %do; 16070 + ods tagsets.gtl event=LayoutRegion(start) 16071 + options(title ="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))" 16072 + title2="%sysfunc(sasmsg(sashelp.dmine, rpt_processflow_title, NOQUOTE))"); 16073 + %end; 16075 + %if &runBatch ne 1 %then %do; 16076 + ods tagsets.gtl event=PFD options(pfditems="PFDItemList" id="pfdView1"); 16077 + ods tagsets.gtl event=LayoutRegion(finish); 16078 + ods tagsets.gtl close; 16079 + ods &EM_REPORT_FORMAT select ALL ; /* re-enable sgrender output */ 16080 + ods proclabel = "%sysfunc(sasmsg(sashelp.dmine, rpt_processflow_title, NOQUOTE))"; 16081 + proc sgsilk viewxml="&viewfile" dataxml="&dataxfile"; run; 16082 + %end; 16083 + title1; title2; title3; 16085 +%mend em_report_workspace_render; 16088 +%macro EM_REPORT_RESULTS( 16089 + path=, /*-- output location ---*/ 16090 + lib=, /*-- em workspace library ---*/ 16091 + startnodeid=, /*-- starting nodeid ---*/ 16092 + showall=, /*-- show all content Y or N ---*/ 16093 + nodes=, /*-- nodes to generate report on ---*/ 16094 + format=, /*-- format for generated report ---*/ 16095 + style= /*--- style for ODS statement ---*/ 16096 +) ; 16098 + data _null_ ; 16099 + call symput('report_date', strip(put(date(), NLDATE.))); 16100 + call symput('report_time', %nrbquote(strip(put(datetime(), NLTIME.)))); 16101 + run; 16103 + data _null_; 16104 + file print ; 16105 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_user_note, NOQUOTE, &sysuserid))" ; 16106 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_date_note, NOQUOTE, %nrbquote(&report_time), &report_date))" ; 16107 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_project_note, NOQUOTE, &EM_REPORT_PROJECT_TEXT)) " ; 16108 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_diagram_note, NOQUOTE, %nrstr(&EM_REPORT_DIAGRAM_TEXT)))" / ; 16109 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_startnode_note, NOQUOTE, &startnodeid))"; 16110 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_nodelabel_note, NOQUOTE, %nrbquote(&em_report_node_text)))" ; 16111 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_nodes_note, NOQUOTE, &EM_REPORT_NODES))" ; 16112 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_showall_note, NOQUOTE, &EM_REPORT_SHOWALL))" / ; 16113 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_format_note, NOQUOTE, &EM_REPORT_FORMAT))" ; 16114 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_graphics_note, NOQUOTE, &EM_REPORT_GDEVICE))" ; 16115 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_style_note, NOQUOTE, &STYLE))" / ; 16116 + run ; 16118 + /* add report view to results */ 16119 + %EM_GETNAME(key=REPORT, type=FILE, extension=&FORMAT); 16120 + %EM_REPORT(KEY=REPORT, BLOCK=MODEL, VIEWTYPE = FILEVIEWER, autodisplay=Y, DESCRIPTION=CUSTOM); 16122 +%mend; 16124 +%macro EM_REPORT_CREATERESULTS(); 16126 + %EM_GETNAME(key=ODSRESULTS, type=FILE, extension=htm, folder=ODS); 16127 + filename x "&EM_FILE_ODSRESULTS" nobom; 16129 + ods listing close; 16130 + ods html3 file=X encoding = "utf-8" style=styles.em_style; 16131 + ods html3 text=" "; 16132 + %if "&EM_REPORT_TITLE" ne "" %then %do; 16133 + ods html3 text="&EM_REPORT_TITLE"; 16134 + %end; 16135 + %else %do; 16136 + ods html3 text="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; 16137 + %end; 16139 + data _null_ ; 16140 + call symput('report_date', strip(put(date(), NLDATE.))); 16141 + call symput('report_time', %nrbquote(strip(put(datetime(), NLTIME.)))); 16142 + run; 16144 + data _null_; 16145 + file print ; 16146 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_user_note, NOQUOTE, &sysuserid))" ; 16147 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_date_note, NOQUOTE, %nrbquote(&report_time), &report_date))" ; 16148 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_project_note, NOQUOTE, &EM_REPORT_PROJECT_TEXT)) " ; 16149 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_diagram_note, NOQUOTE, %nrstr(&EM_REPORT_DIAGRAM_TEXT)))" / ; 16150 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_startnode_note, NOQUOTE, &startnodeid))"; 16151 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_nodelabel_note, NOQUOTE, %nrbquote(&em_report_node_text)))" ; 16152 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_nodes_note, NOQUOTE, &EM_REPORT_NODES))" ; 16153 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_showall_note, NOQUOTE, &showall))" / ; 16154 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_format_note, NOQUOTE, &EM_REPORT_FORMAT))" ; 16155 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_graphics_note, NOQUOTE, &EM_REPORT_GDEVICE))" ; 16156 + put "%sysfunc(sasmsg(sashelp.dmine, rpt_style_note, NOQUOTE, &EM_REPORT_STYLE))" / ; 16157 + run ; 16159 + filename x; 16160 + ods listing; 16161 + ods html3 close; 16163 + %EM_REPORT(KEY=ODSRESULTS, BLOCK=MODEL, VIEWTYPE = HTMLVIEW); 16165 +%mend EM_REPORT_CREATERESULTS; NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMRPM.EM_MODELPROPS.SOURCE. 16166 +%macro em_modelprops(dgmid=, modelid=, output=%nrbquote(work.properties)); 16167 + %global mdl_emwsid mdl_modelid; 16168 + %do; 16169 + %let mdl_emwsid = &dgmid; 16170 + %let mdl_modelid = &modelid; 16171 + %let mdl_output = &output; 16172 + 16173 + dm "afa c=sashelp.emrpm.modelprops.scl"; 16174 + %end; 16175 +%mend em_modelprops; NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: Fileref PDFFILE has been deassigned. NOTE: Fileref RTFFILE has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.REPORTER_PLOTMACROS.SOURCE. 16176 +/*---------------------------------------------------------*/ 16177 + * Utility functions:; 16178 +/*---------------------------------------------------------*/ 16180 +%macro EM_REPORT_GTT(); 16182 + %global EM_REPORT_TTL1 EM_REPORT_TTL2 EM_REPORT_TTL3 EM_REPORT_TITLE EM_REPORT_NODE_TEXT EM_REPORT_KEY_description; 16184 + %if "&EM_REPORT_TITLE" ne "" %then %do; 16185 + %let EM_REPORT_ttl1 = &EM_REPORT_TITLE; 16186 + %end; 16187 + %else %do; 16188 + %let EM_REPORT_ttl1 = %sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE)); 16189 + %end; 16191 + %let EM_REPORT_ttl2 = %sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text))); 16193 + %let msg0 = views_descriptions_&em_report_key_description; 16194 + %let msg1 = %sysfunc(sasmsg(sashelp.dmine, views_descriptions_&em_report_key_description, NOQUOTE)); 16195 + %if %sysfunc(exist(sashelp.tmine)) %then %do; 16196 + %let msg2 = %sysfunc(sasmsg(sashelp.tmine, views_descriptions_&em_report_key_description, NOQUOTE)); 16197 + %end; 16198 + %else %do; 16199 + %let msg2=views_descriptions_&em_report_key_description; 16200 + %end; 16202 + %if "%sysfunc(strip(%nrstr(&msg1)))" ne "%sysfunc(strip(&msg0))" 16203 + %then %do; 16204 + %let EM_REPORT_ttl3 = %sysfunc(sasmsg(sashelp.dmine, views_descriptions_&em_report_key_description, NOQUOTE)); 16205 + %end; 16206 + %else %if "%sysfunc(strip(%nrstr(&msg2)))" ne "%sysfunc(strip(&msg0))" 16207 + %then %do; 16208 + %if %sysfunc(exist(sashelp.tmine)) %then %do; 16209 + %let EM_REPORT_ttl3 = %sysfunc(sasmsg(sashelp.tmine, views_descriptions_&em_report_key_description, NOQUOTE)); 16210 + %end; 16211 + %end; 16212 + %else %do; 16213 + %let EM_REPORT_ttl3 = &em_report_key_description; 16214 + %end; 16216 + /*--- special labels ---*/ 16218 + %if "&EM_REPORT_KEY_DESCRIPTION" eq "REGEFFECTS" 16219 + %then %do; 16220 + %let EM_REPORT_ttl3 = %sysfunc(sasmsg(sashelp.dmine, rpt_regressionmod_title, NOQUOTE)); 16221 + %end; 16223 +%mend; 16225 +/*---------------------------------------------------------*/ 16226 +* Plots created by SGPLOT: LINEPLOT, SCATTER, PLOT, BAR; 16227 +/*---------------------------------------------------------*/ 16229 +%macro EM_REPORT_SGPLOT(type=); 16231 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16233 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 16235 + /*--- EM_REPORT_SGPLOT 1. identify the plot statement ---*/ 16237 + %let axisstmt = xaxis; 16239 + %if &type eq LINEPLOT %then %let plotstmt = series; 16240 + %if &type eq PLOT %then %let plotstmt = series; 16241 + %if &type eq SCATTER %then %let plotstmt = scatter; 16242 + %if &type eq BARPLOT %then %let plotstmt = vbar; 16243 + %if &type eq HISTOGRAM %then %let plotstmt = histogram; 16245 + %if "&plotstmt" eq "vbar" and "%upcase(&EM_REPORT_KEY_ORIENTATION)" eq "HORIZONTAL" 16246 + %then %do; 16247 + %let plotstmt = hbar; 16248 + %let axisstmt = yaxis; 16249 + %end; 16250 + /*--- EM_REPORT_SGPLOT 2. options for plot statements ---*/ 16252 + %let plotopt = ; 16254 + %if &type eq LINEPLOT %then %do; 16255 + %if "&EM_REPORT_KEY_GROUP" ne "" %then %let plotopt = %str(&plotopt group = &EM_REPORT_KEY_GROUP); 16256 + %end; 16257 + %else %if &type eq PLOT %then %do; 16258 + %if "&EM_REPORT_KEY_GROUP" ne "" %then %let plotopt = %str(&plotopt group = &EM_REPORT_KEY_GROUP); 16259 + %end; 16260 + %else %if &type eq SCATTER %then %do; 16261 + %if "&EM_REPORT_KEY_GROUP" ne "" %then %let plotopt = %str(&plotopt group = &EM_REPORT_KEY_GROUP); 16262 + %if "&EM_REPORT_KEY_FREQUENCY" ne "" %then %let plotopt = %str(&plotopt freq=&EM_REPORT_KEY_FREQUENCY); 16263 + %let plotopt = %str(&plotopt markerattrs=(symbol=squarefilled)); 16264 + %end; 16265 + %else %if &type eq BARPLOT %then %do; 16266 + %let plotopt = missing; 16267 + %if "&EM_REPORT_KEY_FREQUENCY" ne "" %then %let plotopt = %str(&plotopt response=&EM_REPORT_KEY_FREQUENCY); 16268 + %if "&EM_REPORT_KEY_SUBGROUP" ne "" %then %let plotopt = %str(&plotopt group=&EM_REPORT_KEY_SUBGROUP); 16269 + %else %if "&EM_REPORT_KEY_GROUP" ne "" %then %let plotopt = %str(&plotopt group=&EM_REPORT_KEY_GROUP); 16270 + %end; 16271 + %else %if &type eq HISTOGRAM %then %do; 16272 + %if "&EM_REPORT_KEY_FREQUENCY" ne "" %then %let plotopt = %str(&plotopt freq=&EM_REPORT_KEY_FREQUENCY); 16273 + %if "&EM_REPORT_KEY_SUBGROUP" ne "" %then %let plotopt = %str(&plotopt group=&EM_REPORT_KEY_SUBGROUP); 16274 +/* %if "&EM_REPORT_KEY_Y" ne "" %then %let plotopt = %str(&plotopt group=&EM_REPORT_KEY_Y);*/ 16275 + %end; 16277 + %if "&plotopt" ne "" %then %let plotopt = %str(/ &plotopt); 16279 + /*--- EM_REPORT_SGPLOT 3. handle _ANYNUMERIC_ or BYSET---*/ 16281 + %if &type eq PLOT and "&EM_REPORT_KEY_Y" eq "_ANYNUMERIC_" %then %do; 16283 + proc contents data=&pdat out=_rptsgplot_temp(keep=name type) noprint; 16284 + run; 16286 + /*** For _ANYNUMERIC_, get the first numeric variable that is not X ***/ 16287 + data _null_; 16288 + set _rptsgplot_temp(where=(type eq 1 and upcase(name) ne "%upcase(&EM_REPORT_KEY_X)")); 16289 + if _n_=1 then call symput("EM_REPORT_KEY_Y", strip(name)); 16290 + run; 16291 + %end; 16293 + /*--- EM_REPORT_SGPLOT 4. call SGPLOT ---*/ 16295 + ods graphics / discretemax=5000; 16297 + proc sgplot data=&pdat.&EM_REPORT_KEY_WHERECLAUSE; 16299 + %if "&EM_REPORT_KEY_Y" ne "" and "&type" ne "BARPLOT" and "&type" ne "HISTOGRAM" %then %do; 16300 + %let i = 1; 16301 + %do %while ("%scan(&EM_REPORT_KEY_Y,&i,' ')" ne ""); 16302 + %let thisY=%scan(&EM_REPORT_KEY_Y,&i,' '); 16303 + %let i = %eval(&i+1); 16304 + &plotstmt 16305 + x = &EM_REPORT_KEY_X y = &thisY &plotopt 16306 + ; 16307 + %end; 16308 + %end; 16309 + %if "&EM_REPORT_KEY_Y2" ne "" and "&type" ne "BARPLOT" and "&type" ne "HISTOGRAM" %then %do; 16310 + &plotstmt 16311 + x = &EM_REPORT_KEY_X y = &EM_REPORT_KEY_Y2 &plotopt 16312 + ; 16313 + %end; 16314 + %if "&type" eq "BARPLOT" %then %do; 16315 + &plotstmt 16316 + &EM_REPORT_KEY_X &plotopt; 16317 + &axisstmt 16318 + type=discrete /* discreteorder=data */ 16319 + %if "&EM_REPORT_KEY_DESCRIPTION" eq "REGEFFECTS" %then %do; display=(NOVALUES NOTICKS) %end; 16320 + ; 16321 + %end; 16322 + %if "&type" eq "HISTOGRAM" and "&EM_REPORT_KEY_FREQUENCY" ne "" %then %do; 16323 + &plotstmt 16324 + &EM_REPORT_KEY_X &plotopt; 16325 + &axisstmt 16326 + %if "&EM_REPORT_KEY_DESCRIPTION" eq "REGEFFECTS" %then %do; display=(NOVALUES NOTICKS) %end; 16327 + ; 16328 + %end; 16329 + %if "&type" eq "HISTOGRAM" and "&EM_REPORT_KEY_FREQUENCY" eq "" %then %do; 16330 + &plotstmt &EM_REPORT_KEY_X; 16331 + %end; 16332 + %if "&type" ne "BARPLOT" and "&type" ne "HISTOGRAM" %then %do; 16333 + %if "&EM_REPORT_KEY_YREF" ne "" %then %do; refline &EM_REPORT_KEY_YREF / axis = y; %end; 16334 + %if "&EM_REPORT_KEY_XREF" ne "" %then %do; refline &EM_REPORT_KEY_XREF / axis = x; %end; 16335 + %end; 16337 + keylegend; 16338 + run; quit; 16340 + %if "&EM_REPORT_KEY_DESCRIPTION" eq "REGEFFECTS" %then %do; 16341 + %EM_REPORT_makeMultiColumn(dat=&pdat.&EM_REPORT_KEY_WHERECLAUSE, vars=effectnum variable classlevel coefficient tvalue pvalue, split=2); 16342 + %end; 16344 + ods graphics / discretemax=100; 16345 + title1; title2; title3; 16347 +%mend EM_REPORT_SGPLOT; 16349 +/*---------------------------------------------------------*/ 16350 +* Plots rendered by SGSILK: DTREE, ICICLE, PIE; 16351 +/*---------------------------------------------------------*/ 16353 +%macro EM_REPORT_SGSILK(type=); 16355 + %local temp path view datax viewfile dataxfile; 16356 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16358 + /*--- EM_REPORT_SGSILK 1. define the XML files for view and data ---*/ 16360 + %let temp = %nrbquote(%sysfunc(PATHNAME(&EM_REPORT_LIB))); 16361 + %let path = %nrbquote(%sysfunc(tranwrd(&temp, %str(%"),""))); 16362 + %let view = view.xml; 16363 + %let datax = data.xml; 16364 + %let viewfile = %nrbquote(&path&em_dsep&EM_NODEID&em_dsep&view); 16365 + %let dataxfile = %nrbquote(&path&em_dsep&EM_NODEID&em_dsep&datax); 16367 + /*--- EM_REPORT_SGSILK 2. Call SGRENGER and setup GTL tagsets---*/ 16369 + ods &EM_REPORT_FORMAT exclude SGRENDER; /* disable sgrender output to PDF */ 16370 + ods tagsets.gtl file="&viewfile" data="&dataxfile" encoding="utf-8" style=styles.em_style; 16372 + %if &type eq DTREE %then %do; /****** DTREE ******/ 16374 + proc sgrender data=&pdat.&EM_REPORT_KEY_WHERECLAUSE template=dataonly; 16375 + dynamic var1 = "&EM_REPORT_KEY_ID"; 16376 + dynamic var2 = "&EM_REPORT_KEY_PARENT"; 16377 + dynamic var3 = "&EM_REPORT_KEY_NODETEXT"; 16378 + dynamic var4 = "&EM_REPORT_KEY_NODECOLOR"; 16379 + dynamic var5 = "&EM_REPORT_KEY_ABOVETEXT"; 16380 + dynamic var6 = "&EM_REPORT_KEY_BELOWTEXT"; 16381 + dynamic var7 = "&EM_REPORT_KEY_LINKWIDTH"; 16382 + run; 16384 + ods tagsets.gtl event=LayoutRegion(start) 16385 + options(title="&EM_REPORT_TTL1" title2="&EM_REPORT_TTL2" title3="&EM_REPORT_TTL3"); 16387 + ods tagsets.gtl event=DecisionTree 16388 + options( id = "&EM_REPORT_KEY_ID" 16389 + parent = "&EM_REPORT_KEY_PARENT" 16390 + nodetext = "&EM_REPORT_KEY_NODETEXT" 16391 + abovetext = "&EM_REPORT_KEY_ABOVETEXT" 16392 + belowtext = "&EM_REPORT_KEY_BELOWTEXT" 16393 + linkwidth = "&EM_REPORT_KEY_LINKWIDTH" 16394 + nodecolor = "&EM_REPORT_KEY_NODECOLOR" ); 16396 + %end; 16397 + %else %if &type eq ICICLE %then %do; /****** ICICLE ******/ 16399 + proc sgrender data=&pdat.&EM_REPORT_KEY_WHERECLAUSE template=dataonly; 16400 + dynamic var1="&EM_REPORT_KEY_ID"; 16401 + dynamic var2="&EM_REPORT_KEY_PARENT"; 16402 + dynamic var3="&EM_REPORT_KEY_NODECOLOR"; 16403 + dynamic var4="&EM_REPORT_KEY_NODESIZE"; 16404 + run; 16406 + ods tagsets.gtl event=LayoutRegion(start) 16407 + options(title="&EM_REPORT_TTL1" title2="&EM_REPORT_TTL2" title3="&EM_REPORT_TTL3"); 16409 + ods tagsets.gtl event=Icicle 16410 + options( id = "&EM_REPORT_KEY_ID" 16411 + parent = "&EM_REPORT_KEY_PARENT" 16412 + nodecolor = "&EM_REPORT_KEY_NODECOLOR" 16413 + nodesize = "&EM_REPORT_KEY_NODESIZE" ); 16415 + %end; 16416 + %else %if &type eq PIE %then %do; /****** PIE ******/ 16418 + proc sgrender data=&pdat.&EM_REPORT_KEY_WHERECLAUSE template=dataonly; 16419 + dynamic var1="&EM_REPORT_KEY_X" var2="&EM_REPORT_KEY_Y"; 16420 + run; quit; 16422 + ods tagsets.gtl event=LayoutRegion(start) 16423 + options(title="&EM_REPORT_TTL1" title2="&EM_REPORT_TTL2" title3="&EM_REPORT_TTL3"); 16425 + ods tagsets.gtl event=Pie 16426 + options( category = "&EM_REPORT_KEY_X" 16427 + response = "&EM_REPORT_KEY_Y" 16428 + pielabeldisplay = "1" ); 16430 + %end; 16432 + ods tagsets.gtl event=LayoutRegion(finish); 16433 + ods tagsets.gtl close; 16435 + /*--- EM_REPORT_SGSILK 3. Call SGSILK to render the graph---*/ 16437 + ods &EM_REPORT_FORMAT select ALL; /* re-enable sgrender output */ 16438 + proc sgsilk viewxml="&viewfile" dataxml="&dataxfile"; run; 16439 + title1; title2; title3; 16440 +%mend; 16442 +/*---------------------------------------------------------*/ 16443 +* DENDROGRAM <- PROC TREE; 16444 +/*---------------------------------------------------------*/ 16446 +%macro EM_REPORT_DENDROGRAM() ; 16448 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16450 + *goptions device=&EM_REPORT_GDEVICE ; 16451 + goptions reset=all device=&EM_REPORT_GDEVICE; 16453 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 16455 + axis1 minor=none label=(height = &EM_REPORT_TEXT_SIZE pt ) ; 16456 + axis2 minor=none label=(height = &EM_REPORT_TEXT_SIZE pt angle=90 ) ; 16458 + ods &EM_REPORT_FORMAT select ALL; /* re-enable sgrender output */ 16460 + proc tree data=&pdat.&EM_REPORT_KEY_WHERECLAUSE horizontal haxis=axis1 vaxis=axis2; 16461 + height &EM_REPORT_KEY_HEIGHT; 16462 + name &EM_REPORT_KEY_NAME; 16463 + parent &EM_REPORT_KEY_PARENT; 16464 + run; quit; 16466 + title1; title2; title3 ; 16467 + axis1; axis2; 16469 +%mend EM_REPORT_DENDROGRAM; 16471 +/*---------------------------------------------------------*/ 16472 +* EVENTPLOT <- SGSCATTER; 16473 +/*---------------------------------------------------------*/ 16475 +%macro EM_REPORT_EVENTPLOT(); 16477 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16479 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 16481 + proc sgscatter data=&pdat.&EM_REPORT_KEY_WHERECLAUSE; 16482 + plot (_cumulative_event_count_ _marginal_event_rate_ _event_count_ _cumulative_event_rate_) 16483 + * _cutoff_score_ / group=datarole join=() markerattrs=(size=0) grid; 16484 + run; quit; 16486 + title1; title2; title3 ; 16488 +%mend EM_REPORT_EVENTPLOT; 16490 +/*---------------------------------------------------------*/ 16491 + * EM_REPORT_ITERATIONPLOT ; 16492 + * create plots of iterations: neural, stepwise, tree, etc..; 16493 +/*---------------------------------------------------------*/ 16495 +%macro EM_REPORT_ITERATIONPLOT(); 16497 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16498 + %let X = &EM_REPORT_KEY_X; 16500 + title1 "&EM_REPORT_TTL1"; 16501 + title2 "&EM_REPORT_TTL2"; 16502 + title3 "%sysfunc(sasmsg(sashelp.dmine, rpt_mdliterationplot_title, NOQUOTE))"; 16504 + %local _misc_ _vmisc_ _ase_ _vase_ ; 16505 + data _null_ ; 16506 + set &pdat(obs=2) end=eof; 16507 + if eof then do ; 16508 + call symput('_ase_',_ase_); 16509 + call symput('_vase_',_vase_); 16510 + call symput('_misc_',_misc_); 16511 + call symput('_vmisc_',_vmisc_); 16512 + end; 16513 + run; 16515 + %let dsid = %sysfunc(open(&pdat)); 16516 + %if &dsid %then %do; 16517 + %let _ase_ = %sysfunc(VARNUM(&dsid, _ase_)); 16518 + %let _vase_ = %sysfunc(VARNUM(&dsid, _vase_)); 16519 + %let _misc_ = %sysfunc(VARNUM(&dsid, _misc_)); 16520 + %let _vmisc_ = %sysfunc(VARNUM(&dsid, _vmisc_)); 16521 + %end; 16522 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 16524 + %if "&_ase_" eq "." %then %let _ase_ = 0; 16525 + %if "&_vase_" eq "." %then %let _vase_ = 0; 16526 + %if "&_misc_" eq "." %then %let _misc_ = 0; 16527 + %if "&_vmisc_" eq "." %then %let _vmisc_ = 0; 16529 + %put &_ase_ &_vase_ &_misc_ &_vmisc_; 16531 + %if &_vmisc_ ne 0 %then %do; 16532 + proc sql noprint; 16533 + select count(*) into :nonMiss_vmisc from &pdat where _vmisc_ ne .; 16534 + quit; 16535 + %end; 16536 + %else %do; 16537 + %let nonMiss_vmisc = 0; 16538 + %end; 16540 + ods path(prepend) work.templat(update); 16541 + proc template; 16542 + define statgraph em.IterationPlot / store=work.templat; 16543 + begingraph; 16544 + entrytitle "&EM_REPORT_TTL1"; 16545 + entrytitle "&EM_REPORT_TTL2"; 16546 + entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_mdliterationplot_title, NOQUOTE))"; 16548 + layout lattice / order=columnmajor rows=1 rowdatarange=data columngutter=10; 16550 + %if &_ase_ ne 0 or &_vase_ ne 0 %then %do; 16551 + layout overlay / cycleattrs=true 16552 + xaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, rpt_iteration_vlabel, NOQUOTE))") 16553 + yaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, stat_ase_vlabel, NOQUOTE))"); 16554 + %if &_ase_ ne 0 %then %do ; 16555 + seriesplot x=&X y=_ASE_ / markerattrs=(size=0) display=all name='train' 16556 + legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_roletrain_value, NOQUOTE))"; 16557 + %end; 16558 + %if &_vase_ ne 0 %then %do ; 16559 + seriesplot x=&X y=_VASE_ / markerattrs=(size=0) display=all name='validate' 16560 + legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_rolevalidate_value, NOQUOTE))"; 16561 + %end; 16562 + %if "&EM_REPORT_KEY_XREF" ne "" %then %do; referenceline x=&EM_REPORT_KEY_XREF; %end; 16563 + endlayout; 16564 + %end; 16566 + %if &_misc_ ne 0 or ( &_vmisc_ ne 0 and &nonMiss_vmisc ne 0) %then %do; 16567 + layout overlay / cycleattrs=true 16568 + xaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, rpt_iteration_vlabel, NOQUOTE))") 16569 + yaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, rpt_misclassrate_vlabel, NOQUOTE))"); 16570 + %if &_misc_ ne 0 %then %do; 16571 + seriesplot x=&X y=_MISC_ / markerattrs=(size=0) display=all; 16572 + %end; 16573 + %if &_vmisc_ ne 0 %then %do ; 16574 + seriesplot x=&X y=_VMISC_ / markerattrs=(size=0) display=all; 16575 + %end; 16576 + %if "&EM_REPORT_KEY_XREF" ne "" %then %do; referenceline x=&EM_REPORT_KEY_XREF; %end; 16577 + endlayout; 16578 + %end; 16580 + sidebar / align=bottom; 16581 + layout overlay; 16582 + discretelegend 'train' 'validate' / down=1 order=columnmajor; 16583 + endlayout; 16584 + endsidebar; 16585 + endlayout; 16586 + endgraph; 16587 + end; 16588 + run; 16590 + proc sort data=&pdat.&EM_REPORT_KEY_WHERECLAUSE out=_tmprpt_iterdat; 16591 + by &X; 16592 + run; 16594 + proc sgrender data=_tmprpt_iterdat template='em.IterationPlot'; 16595 + run; 16596 + title1; title2; title3; 16598 + proc delete data=_tmprpt_iterdat; run; 16600 +%mend EM_REPORT_ITERATIONPLOT; 16602 +/* for hpdmassess */ 16604 +%macro EM_REPORT_HPDMASSESS(); 16606 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16608 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 16610 + /*--- EM_REPORT_HPDMASSESS 1. idenfity the variables ---*/ 16612 + %let dsid = %sysfunc(open(&pdat)); 16613 + %if &dsid %then %do; 16614 + %let lift = %sysfunc(VARNUM(&dsid, lift)); 16615 + %let c_lift = %sysfunc(VARNUM(&dsid, c_lift)); 16616 + %let mean1 = %sysfunc(VARNUM(&dsid, target_mean)); 16617 + %let mean2 = %sysfunc(VARNUM(&dsid, predicted_mean)); 16618 + %let datarole = %sysfunc(VARNUM(&dsid, &EM_REPORT_KEY_GROUP)); 16619 + %end; 16620 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 16622 + %if "&lift" eq "." %then %let lift = 0; 16623 + %if "&c_lift" eq "." %then %let c_lift = 0; 16624 + %if "&mean1" eq "." %then %let mean1 = 0; 16625 + %if "&mean2" eq "." %then %let mean2 = 0; 16626 + %if "&datarole" eq "." %then %let datarole = 0; 16628 + %put &lift &c_lift &mean1 &mean2 &datarole; 16630 + %if &lift ne 0 and &c_lift ne 0 %then %do; 16631 + %let hpdm_plot = 1; 16632 + %let hpdm_var1 = lift; 16633 + %let hpdm_var2 = c_lift; 16634 + %let hpdm_lbl1 = assmt_lift_vlabel; 16635 + %let hpdm_lbl2 = assmt_liftc_vlabel; 16636 + %end; 16637 + %else 16638 + %if &mean1 ne 0 and &mean2 ne 0 16639 + %then %do; 16640 + %let hpdm_plot = 1; 16641 + %let hpdm_var1 = target_mean; 16642 + %let hpdm_var2 = predicted_mean; 16643 + %let hpdm_lbl1 = rpt_rpttargetmean_vlabel; 16644 + %let hpdm_lbl2 = rpt_rptpredmean_vlabel; 16645 + %end; 16646 + %else %do; 16647 + %let hpdm_plot = 0; 16648 + %let hpdm_var1 = ; 16649 + %let hpdm_var2 = ; 16650 + %let hpdm_lbl1 = ; 16651 + %let hpdm_lbl2 = ; 16652 + %end; 16653 + /*--- EM_REPORT_HPDMASSESS 2. call SGPANEL ---*/ 16655 + %if &hpdm_plot eq 1 %then %do; 16656 + ods path(prepend) work.templat(update); 16657 + proc template; 16658 + define statgraph em.hpdmassess / store=work.templat; 16659 + begingraph; 16660 + entrytitle "&EM_REPORT_TTL1"; 16661 + entrytitle "&EM_REPORT_TTL2"; 16662 + entrytitle "&EM_REPORT_TTL3"; 16664 + layout lattice / order=columnmajor rows=1 rowdatarange=data columngutter=10; 16666 + %if &datarole ne 0 %then %do; 16667 + layout overlay / cycleattrs=true 16668 + xaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, rpt_depth_vlabel, NOQUOTE))") 16669 + yaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, &hpdm_lbl1, NOQUOTE))") 16670 + ; 16671 + seriesplot x=&EM_REPORT_KEY_X y=&hpdm_var1 / name='var1' markerattrs=(size=0) display=all group=&EM_REPORT_KEY_GROUP; 16672 + endlayout; 16673 + layout overlay / cycleattrs=true 16674 + xaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, rpt_depth_vlabel, NOQUOTE))") 16675 + yaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, &hpdm_lbl2, NOQUOTE))") 16676 + ; 16677 + seriesplot x=&EM_REPORT_KEY_X y=&hpdm_var2 / markerattrs=(size=0) display=all group=&EM_REPORT_KEY_GROUP; 16678 + endlayout; 16679 + sidebar / align = bottom; 16680 + layout overlay; 16681 + discretelegend 'var1' / down=1 order=columnmajor; 16682 + endlayout; 16683 + endsidebar; 16684 + %end; 16685 + %else %do; 16686 + layout overlay / cycleattrs=true 16687 + xaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, rpt_depth_vlabel, NOQUOTE))") 16688 + yaxisopts=(griddisplay=on label="%sysfunc(sasmsg(sashelp.dmine, &hpdm_lbl1, NOQUOTE))") 16689 + ; 16690 + seriesplot x=&EM_REPORT_KEY_X y=&hpdm_var1 / markerattrs=(size=0) display=all name='var1' 16691 + legendlabel="%sysfunc(sasmsg(sashelp.dmine, &hpdm_lbl1, NOQUOTE))"; 16692 + seriesplot x=&EM_REPORT_KEY_X y=&hpdm_var2 / markerattrs=(size=0) display=all name='var2' 16693 + legendlabel="%sysfunc(sasmsg(sashelp.dmine, &hpdm_lbl2, NOQUOTE))"; 16694 + endlayout; 16695 + sidebar / align=bottom; 16696 + layout overlay; 16697 + discretelegend 'var1' 'var2' / down=1 order=columnmajor; 16698 + endlayout; 16699 + endsidebar; 16700 + %end; 16701 + endlayout; 16702 + endgraph; 16703 + end; 16704 + run; 16706 + proc sgrender data=&pdat.&EM_REPORT_KEY_WHERECLAUSE template='em.hpdmassess'; run; 16707 + %end; 16709 + title1; title2; title3; 16711 +%mend EM_REPORT_HPDMASSESS; 16713 +/* for heatmap version of histograms */ 16715 +%macro EM_REPORT_HEATMAPTEMPLATE(); 16717 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16719 + %if "&EM_REPORT_KEY_FREQUENCY" ne "" "&EM_REPORT_KEY_X" ne "" "&EM_REPORT_KEY_Y" ne "" %then %do; 16721 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 16723 + proc template; 16724 + define statgraph heatmap; 16725 + begingraph; 16726 + entrytitle "&EM_REPORT_TTL1"; 16727 + entrytitle "&EM_REPORT_TTL2"; 16728 + entrytitle "&EM_REPORT_TTL3"; 16729 + layout overlay; 16730 + heatmapparm x=&EM_REPORT_KEY_X y=&EM_REPORT_KEY_Y colorresponse=&EM_REPORT_KEY_FREQUENCY / name="map" display=all; 16731 + continuouslegend "map"; 16732 + endlayout; 16733 + endgraph; 16734 + end; 16736 + proc sgrender data=&pdat.&EM_REPORT_KEY_WHERECLAUSE template=heatmap; run; 16738 + %end; 16740 + title1; title2; title3; 16742 +%mend EM_REPORT_HEATMAPTEMPLATE; 16745 +/* for assessment plot */ 16747 +%macro EM_REPORT_EMRANK(pdat=, lattice=no) ; 16749 + data _tmp_dat; 16750 + set &pdat.&EM_REPORT_KEY_WHERECLAUSE; 16751 + run; 16752 + %let pdat = _tmp_dat; 16754 + %let varList = GAIN CAPC LIFTC RESPC _MEANP_ _MINP_ _MAXP_; 16755 + %let varNum = 7; 16756 + %let modelVar = model; 16757 + %do k = 1 %to &varNum; 16758 + %let thisVar = %scan(&varList,&k,' '); 16759 + %let var_&thisVar = ; 16760 + %end; 16762 +/*-----------------------------------------------------------------------------*/ 16764 + proc contents data=&pdat out=_tmp_content(keep=name) noprint; 16765 + run; 16767 + %let is_cat = 0; 16768 + %let has_loop = 0; 16769 + %let has_where = 0; 16771 + data _null_; 16772 + set _tmp_content; 16773 + name=strip(upcase(name)); 16774 + format _tmp_list $500.; 16775 + _tmp_list = symget('varList'); 16777 + do k = 1 to &varNum; 16778 + if name eq scan(_tmp_list,k,' ') then call symput(cats('var_',name),name); 16779 + end; 16781 + if name eq '_LOOP_' then call symput('has_loop','1'); 16782 + if name eq '_WHERE_' then call symput('has_where','1'); 16783 + if name eq 'GAIN' then call symput('is_cat','1'); 16784 + run; 16786 + %if &has_loop eq 1 %then %do; 16787 + %if &has_where eq 1 %then %do; 16788 + proc sql noprint; 16789 + select count(*) into :nn1 from &pdat; 16790 + select count(*) into :nn2 from &pdat where _where_ is missing; 16791 + quit; 16792 + %if &nn1 ne &nn2 16793 + %then %let modelvar = _where_; 16794 + %else %let modelvar = ; 16795 + %end; 16796 + %else %do; 16797 + %let modelvar = ; 16798 + %end; 16799 + %end; 16801 +/*-----------------------------------------------------------------------------*/ 16803 + %if "&lattice" eq "yes" %then %do ; 16805 + proc sql noprint; 16806 + select count(distinct datarole) into :ndataroles from &pdat; 16807 + select distinct datarole into :drole1-:drole%left(&ndataroles) from &pdat; 16808 + quit; 16810 + %do d =1 %to &ndataroles; 16812 + proc sort data=&pdat(where=(datarole eq "&&&drole&d")) out=_tmp_emrp; 16813 + by &modelvar decile; 16814 + run; 16816 + title1 "&EM_REPORT_TTL1"; 16817 + title2 "&EM_REPORT_TTL2"; 16818 + title3 "%sysfunc(sasmsg(sashelp.dmine, rpt_multiplemdlassess_title, NOQUOTE, &&&drole&d))"; 16819 + %if "&EM_REPORT_KEY_WHERE" ne " " %then %do; 16820 + title4 "&EM_REPORT_KEY_WHERE"; 16821 + %end; 16823 + proc sgscatter data=_tmp_emrp; 16824 + plot 16825 + %if &is_cat eq 1 %then %do; 16826 + (&var_gain &var_liftc &var_capc &var__meanp_) * decile 16827 + %end; 16828 + %else %do; 16829 + (&var__meanp_ &var__minp_ &var__maxp_) * decile 16830 + %end; 16831 + / %if &modelvar ne %then %do; group=&modelvar %end; 16832 + join=() markerattrs=(size=0) grid 16833 + ; 16834 + run; quit; 16835 + title1; title2; title3; title4; 16836 + %end; 16837 + %end; 16838 + %else %do; 16840 + proc sort data=&pdat out=_tmp_emrp; 16841 + by target datarole; 16842 + run; 16844 + title1 "&EM_REPORT_TTL1"; 16845 + title2 "&EM_REPORT_TTL2"; 16846 + title3 "%sysfunc(sasmsg(sashelp.dmine, rpt_singlemdlassess_title, NOQUOTE, &em_report_key_where))"; 16848 + %if &is_cat eq 1 %then %do; 16849 + %if "&var_gain" ne " " %then %do; 16850 + proc sgpanel data=_tmp_emrp; 16851 + panelby datarole; 16852 + series x=decile y=gain; series x=decile y=basegain; series x=decile y=bestgain; 16853 + rowaxis grid; colaxis grid; 16854 + run; quit; 16855 + %end; 16856 + %if "&var_liftc" ne " " %then %do; 16857 + proc sgpanel data=_tmp_emrp; 16858 + panelby datarole; 16859 + series x=decile y=liftc; series x=decile y=baseliftc; series x=decile y=bestliftc; 16860 + rowaxis grid; colaxis grid; 16861 + run; quit; 16862 + %end; 16863 + %if "&var_capc" ne " " %then %do; 16864 + proc sgpanel data=_tmp_emrp; 16865 + panelby datarole; 16866 + series x=decile y=capc; series x=decile y=basecapc; series x=decile y=bestcapc; 16867 + rowaxis grid; colaxis grid; 16868 + run; quit; 16869 + %end; 16870 + %end; 16871 + %else %do; 16872 + %if "&var__meanp_" ne " " %then %do ; 16873 + proc sgpanel data=_tmp_emrp; 16874 + panelby datarole; 16875 + series x=decile y=_meanp_; series x=decile y=_targetmean_; 16876 + rowaxis grid; colaxis grid; 16877 + run; quit; 16878 + %end; 16879 + %if "&var__minp_" ne " " %then %do ; 16880 + proc sgpanel data=_tmp_emrp; 16881 + panelby datarole; 16882 + series x=decile y=_minp_; series x=decile y=_targetmin_; 16883 + rowaxis grid; colaxis grid; 16884 + run; quit; 16885 + %end; 16886 + %if "&var__maxp_" ne " " %then %do ; 16887 + proc sgpanel data=_tmp_emrp; 16888 + panelby datarole; 16889 + series x=decile y=_maxp_; series x=decile y=_targetmax_; 16890 + rowaxis grid; colaxis grid; 16891 + run; quit; 16892 + %end; 16893 + %end; 16895 + title1; title2; title3; 16896 + %end; 16898 +%mend; 16901 +%macro EM_REPORT_LATTICE(); 16903 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 16905 + %let numx = 1; 16906 + %let numy = 1; 16908 + proc sql noprint; 16909 + %if "&EM_REPORT_KEY_LATTICEX" ne "" %then %do; 16910 + select count(distinct &EM_REPORT_KEY_LATTICEX) into :numx from &pdat.&EM_REPORT_KEY_WHERECLAUSE; 16911 + %end; 16912 + %if "&EM_REPORT_KEY_LATTICEY" ne "" %then %do; 16913 + select count(distinct &EM_REPORT_KEY_LATTICEY) into :numy from &pdat.&EM_REPORT_KEY_WHERECLAUSE; 16914 + %end; 16915 + quit; 16917 + %let numrows=&numy; 16918 + %let numcols=&numx; 16919 + %let totalnum = %eval(&numx * &numy); 16921 + %if &totalnum gt 6 %then %do; 16922 + %if &totalnum le 18 %then %let numcols=3; 16923 + %else %if &totalnum le 24 %then %let numcols=4; 16924 + %else %if &totalnum le 30 %then %let numcols=5; 16925 + %else %let numcols=3; 16926 + %end; 16928 + %if &totalnum gt 6 %then %do; 16929 + %let numrows = %sysevalf(&totalnum / &numcols); 16930 + %let numrows = %sysfunc(ceil(&numrows)); 16931 + %if &numrows ge 6 %then %let numrows=6; 16932 + %end; 16934 + %if (("&EM_REPORT_KEY_LATTICETYPE" eq "BAR") OR ("&EM_REPORT_KEY_LATTICETYPE" eq "HISTOGRAM")) 16935 + %then %do; 16937 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 16938 + %if "&em_report_key_whereclause" ne "" %then %do ; 16939 + title4 "%sysfunc(sasmsg(sashelp.dmine, rpt_text_title, NOQUOTE, &em_report_key_where))"; 16940 + %end; 16942 + proc sgpanel data=&pdat.&EM_REPORT_KEY_WHERECLAUSE; 16943 + panelby 16944 + %if "&EM_REPORT_KEY_LATTICEY" ne "" %then %do; &EM_REPORT_KEY_LATTICEY %end; 16945 + %if "&EM_REPORT_KEY_LATTICEX" ne "" %then %do; &EM_REPORT_KEY_LATTICEX %end; 16946 + / 16947 + %if &totalnum ge 5 %then %do; columns=&numcols rows=&numrows /*novarname*/ %end; 16948 + uniscale=column 16949 + ; 16950 + /* originally using frequency so keeping this here; */ 16951 + /* eventrate plot in binning sets y var as response so added y as well */ 16953 + %if "&EM_REPORT_KEY_LATTICETYPE" eq "HISTOGRAM" %then %do; 16954 + %if "&EM_REPORT_KEY_FREQUENCY" eq "" %then %do; 16955 + histogram &EM_REPORT_KEY_X; 16956 + %end; 16957 + %else %do; 16958 + histogram &EM_REPORT_KEY_X / freq = &EM_REPORT_KEY_FREQUENCY; 16959 + %end; 16960 + %end; 16961 + %else %do; 16962 + %if "%upcase(&EM_REPORT_KEY_ORIENTATION)" eq "HORIZONTAL" 16963 + %then %do; hbar %end; 16964 + %else %do; vbar %end; 16965 + &EM_REPORT_KEY_X / 16966 + %if "&EM_REPORT_KEY_FREQUENCY" ne "" %then %do; response=&EM_REPORT_KEY_FREQUENCY %end; 16967 + %if "&EM_REPORT_KEY_Y" ne "" %then %do; response=&EM_REPORT_KEY_Y %end; 16968 + %if "&EM_REPORT_KEY_SUBGROUP" ne "" %then %do; group=&EM_REPORT_KEY_SUBGROUP %end; 16969 + %else %if "&EM_REPORT_KEY_GROUP" ne "" %then %do; group=&EM_REPORT_KEY_GROUP %end; 16970 + ; 16971 + %end; 16972 + colaxis grid fitpolicy=rotatethin /* discreteorder=data */; 16973 + rowaxis grid ; 16974 + run; quit; 16976 + /* special treatments */ 16977 + %if "&EM_REPORT_KEY_DESCRIPTION" eq "EVENTRATE" %then %do ; 16978 + %if (("&EM_REPORT_KEY_AUTODISPLAY" eq "Y") OR ("&EM_REPORT_SHOWALL" eq "Y")) %then %do; 16980 + %let wtevexist=0; 16981 + %let dsid = %sysfunc(open(work.pdl)); 16982 + %if &dsid %then %do; 16983 + %let wtevexist = %sysfunc(VARNUM(&dsid, wtev)); 16984 + %end; 16985 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 16987 + %EM_REPORT_TABLETEXT(subtitle=views_descriptions_&em_report_key_description); 16989 + proc print data=&pdat.&EM_REPORT_KEY_WHERECLAUSE noobs label contents=''; 16990 + var display_var _label_ _group_ role eventRate 16991 + %if &wtevexist ne 0 %then %do; wtev %end;; 16992 + run; 16993 + %end; 16994 + %end; 16995 + %end; 16996 + %else %if (("&EM_REPORT_KEY_LATTICETYPE" eq "LINEPLOT") or ("&EM_REPORT_KEY_LATTICETYPE" eq "PLOT")) %then %do; 16998 + proc sort data=&pdat.&EM_REPORT_KEY_WHERECLAUSE out=_tmp_pdl; 16999 + by 17000 + %if "&EM_REPORT_KEY_LATTICEY" ne "" %then %do; &EM_REPORT_KEY_LATTICEY %end; 17001 + %if "&EM_REPORT_KEY_LATTICEX" ne "" %then %do; &EM_REPORT_KEY_LATTICEX %end; 17002 + ; 17003 + run; 17005 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 17006 + %if "&em_report_key_whereclause" ne "" %then %do ; 17007 + title4 "%sysfunc(sasmsg(sashelp.dmine, rpt_text_title, NOQUOTE, &em_report_key_where))"; 17008 + %end; 17010 + proc sgpanel data=_tmp_pdl; 17011 + panelby 17012 + %if "&EM_REPORT_KEY_LATTICEY" ne "" %then %do; &EM_REPORT_KEY_LATTICEY %end; 17013 + %if "&EM_REPORT_KEY_LATTICEX" ne "" %then %do; &EM_REPORT_KEY_LATTICEX %end; 17014 + / 17015 + %if &totalnum ge 5 %then %do; columns=&numcols rows=&numrows /*novarname*/ %end; 17016 + uniscale=column 17017 + ; 17018 + %let i = 1; 17019 + %do %while ("%scan(&EM_REPORT_KEY_Y,&i,' ')" ne ""); 17020 + %let thisY=%scan(&EM_REPORT_KEY_Y,&i,' '); 17021 + %let i = %eval(&i+1); 17022 + series x=&EM_REPORT_KEY_X y=&thisY 17023 + %if "&EM_REPORT_KEY_GROUP" ne "" %then %do; / group=&EM_REPORT_KEY_GROUP %end; 17024 + ; 17025 + %end; 17026 + %if "&EM_REPORT_KEY_Y2" ne "" %then %do; 17027 + series x=&EM_REPORT_KEY_X y=&EM_REPORT_KEY_Y2 17028 + %if "&EM_REPORT_KEY_GROUP" ne "" %then %do; / group=&EM_REPORT_KEY_GROUP %end; 17029 + ; 17030 + %end; 17031 + %if "&EM_REPORT_KEY_YREF" ne "" %then %do; refline &EM_REPORT_KEY_YREF / axis = y; %end; 17032 + %if "&EM_REPORT_KEY_XREF" ne "" %then %do; refline &EM_REPORT_KEY_XREF / axis = x; %end; 17033 + colaxis grid fitpolicy=rotatethin; 17034 + rowaxis grid; 17035 + run; quit; 17036 + %end; 17038 +%mend EM_REPORT_LATTICE; 17040 +/*---------------------------------------------------------*/ 17041 + * EM_REPORT_SCOREDIST2 ; 17042 + * Score Distribution 2; 17043 +/*---------------------------------------------------------*/ 17045 +%macro EM_REPORT_SCOREDIST2() ; 17047 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 17049 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 17051 + proc sgpanel data=&pdat.&EM_REPORT_KEY_WHERECLAUSE; 17052 + panelby 17053 + %if "&EM_REPORT_KEY_LATTICEY" ne "" %then %do; &EM_REPORT_KEY_LATTICEY %end; 17054 + %if "&EM_REPORT_KEY_LATTICEX" ne "" %then %do; &EM_REPORT_KEY_LATTICEX %end; 17055 + / rows=1 uniscale=row layout=lattice 17056 + ; 17057 + vbar &EM_REPORT_KEY_X 17058 + %if "&EM_REPORT_KEY_FREQUENCY" ne "" %then %do; / response=count %end; 17059 + ; 17060 + colaxis fitpolicy=rotatethin; 17061 + run; quit; 17063 +%mend EM_REPORT_SCOREDIST2; 17065 +/*---------------------------------------------------------*/ 17066 + * EM_REPORT_SCOREDIST ; 17067 + * Score Distribution ; 17068 +/*---------------------------------------------------------*/ 17070 +%macro EM_REPORT_SG4SCOREDIST(y1=,y2=,str1=,str2=,rowstr=); 17071 + proc sgpanel data=_tmpdat; 17072 + panelby datarole; 17073 + %if "&y1" ne " " %then %do; 17074 + series x=score y=&y1 / legendlabel="%sysfunc(sasmsg(sashelp.dmine, &str1, NOQUOTE))"; 17075 + %end; 17076 + %if "&y2" ne " " %then %do; 17077 + series x=score y=&y2 / legendlabel="%sysfunc(sasmsg(sashelp.dmine, &str2, NOQUOTE))"; 17078 + %end; 17079 + rowaxis grid label="%sysfunc(sasmsg(sashelp.dmine, &rowstr, NOQUOTE))"; 17080 + colaxis grid; 17081 + run; quit; 17082 +%mend; 17084 +%macro EM_REPORT_SCOREDIST(data=) ; 17086 + data _tmp_scoredist; 17087 + set &EM_REPORT_LIB..&EM_REPORT_KEY_FILE.&EM_REPORT_KEY_WHERECLAUSE; 17088 + run; 17090 + proc contents data=_tmp_scoredist out=_tmp_content(keep=varnum name) noprint; 17091 + run; 17093 + /*--------------------------------------------------------------------------*/ 17095 + %let var_targetMean = ; 17096 + %let var_targetMax = ; 17097 + %let var_targetMin = ; 17098 + %let is_cat = 0; 17099 + %let modeldescnum = 0; 17100 + %let loopnum = 0; 17101 + %let has_where = 0; 17102 + %let has_target = 0; 17104 + data _null_; 17105 + set _tmp_content; 17106 + name=strip(upcase(name)); 17107 + if name eq 'MODELDESCRIPTION' then call symput('modeldescnum', put(varnum,6.)); 17108 + if name eq '_LOOP_' then call symput('loopnum', put(varnum,6.)); 17109 + if name eq '_WHERE_' then call symput('has_where', '1'); 17110 + if name eq '_TARGET_' then call symput('has_target', '1'); 17111 + if name eq '_TARGETMEAN_' then call symput('var_targetMean',name); 17112 + if name eq '_TARGETMAX_' then call symput('var_targetMax', name); 17113 + if name eq '_TARGETMIN_' then call symput('var_targetMin', name); 17114 + if name eq 'PERCENTAGEOFEVENTS' then call symput('is_cat', '1'); 17115 + run; 17117 + /*--------------------------------------------------------------------------*/ 17119 + %if (&modeldescnum eq 0) and (&loopnum eq 0) %then %do; 17120 + %let modelvar = ; 17121 + %let nmodels = 1; 17122 + %let modeldat1 = _tmp_scoredist; 17123 + %end; 17124 + %else %do; 17126 + %if &loopnum gt 0 17127 + %then %do; 17128 + proc sql noprint; 17129 + select count(*) into :nn1 from _tmp_scoredist; 17130 + select count(*) into :nn2 from _tmp_scoredist where _where_ is missing; 17131 + quit; 17132 + %if &nn1 ne &nn2 17133 + %then %let modelvar = _where_; 17134 + %else %let modelvar = target; 17135 + %end; 17136 + %else %let modelvar = model; 17138 + %let nmodels = 1; 17139 + proc sql noprint; 17140 + select count(distinct &modelvar) into :nmodels from _tmp_scoredist; 17141 + select distinct &modelvar into :cond1-:cond%left(&nmodels) from _tmp_scoredist; 17142 + quit; 17144 + %do d = 1 %to &nmodels; 17145 + %let modeldat&d = %str(_tmp_scoredist(where=(&modelvar eq "&&&cond&d"))); 17146 + %end; 17147 + %end; 17149 + /* --- loop through all models or _where_ for plots---*/ 17151 + %do d = 1 %to &nmodels; 17153 + proc sort data=&&&modeldat&d out=_tmpdat; 17154 + by &modelvar target datarole; 17155 + run; 17157 + title1 "&EM_REPORT_TTL1"; 17158 + title2 "&EM_REPORT_TTL2"; 17159 + title3 "%sysfunc(sasmsg(sashelp.dmine, rpt_scoredistsingle_title, NOQUOTE, &em_report_key_where))"; 17160 + %if &nmodels gt 1 %then %do; title4 "&&&cond&d"; %end; 17162 + %if &is_cat eq 1 %then %do; 17163 + %EM_REPORT_SG4SCOREDIST(y1=percentageofevents, y2=percentageofnonevents, 17164 + str1=rpt_events_vlabel, str2=rpt_nonevents_vlabel, rowstr=assmt_percent_vlabel); 17165 + %EM_REPORT_SG4SCOREDIST(y1=cumulativepercentageofevents, y2=cumulativepercentageofnonevents, 17166 + str1=rpt_events_vlabel, str2=rpt_nonevents_vlabel, rowstr=assmt_percentC_vlabel); 17167 + %end; 17168 + %else %do; 17169 + %EM_REPORT_SG4SCOREDIST(y1=_meanP_, y2=&var_targetMean, 17170 + str1=rpt_predicted_vlabel, str2=rpt_target_vlabel, rowstr=rpt_mean_vlabel); 17171 + %EM_REPORT_SG4SCOREDIST(y1=_meanP_, y2=&var_targetMax, 17172 + str1=rpt_predicted_vlabel, str2=rpt_target_vlabel, rowstr=rpt_maximum_vlabel); 17173 + %end; 17175 + proc delete data=_tmpdat; run; 17176 + title1; title2; title3; title4; 17177 + %end; 17179 + /* --- loop through all models or _where_ for prints ---*/ 17181 + %do d = 1 %to &nmodels; 17183 + proc sort data=&&&modeldat&d out=_tmpdat; 17184 + by &modelvar target datarole; 17185 + run; 17187 + title1; title2; title3; 17188 + %EM_REPORT_TABLETEXT(subtitle=rpt_scoredistnone_title); 17190 + %if &is_cat eq 1 %then %do; 17191 + proc print data=_tmpdat noobs label contents=''; 17192 + by &modelvar target datarole; 17193 + var p_label numberofevents percentageofevents percentageofnonevents 17194 + cumulativepercentageofevents cumulativepercentageofnonevents ; 17195 + run; 17196 + %end; 17197 + %else %do; 17198 + proc print data=_tmpdat noobs label contents=''; 17199 + by &modelvar target datarole; 17200 + var p_label _meanP_ _maxP_ _minP_ &var_targetMean &var_targetMax &var_targetMin; 17201 + run; 17202 + %end; 17203 + %end; 17205 +%mend EM_REPORT_SCOREDIST; 17208 +%macro EM_REPORT_MULTIPLY2PLOT; 17210 + data _tmp_dat; 17211 + set &EM_REPORT_LIB..&EM_REPORT_KEY_FILE.&EM_REPORT_KEY_WHERECLAUSE; 17212 + run; 17214 + proc contents data=_tmp_dat out=_tmp_content(keep=name) noprint; 17215 + run; 17217 + %let has_datarole = 0; 17218 + data _null_; 17219 + set _tmp_content; 17220 + name=strip(upcase(name)); 17221 + if name eq "DATEROLE" then call symput('has_datarole','1'); 17222 + run; 17224 + %if &has_datarole eq 1 %then %do; 17225 + proc sql noprint; 17226 + select count(distinct datarole) into :ndataroles from _tmp_dat; 17227 + select distinct datarole into :drole1-:drole%left(&ndataroles) from _tmp_dat; 17228 + quit; 17229 + %end; 17230 + %else %do; 17231 + %let ndataroles = 1; 17232 + %end; 17234 + %if &ndataroles gt 1 %then %do; 17235 + %do d=1 %to &ndataroles ; 17237 + proc sort data=_tmp_dat(where=(datarole eq "&&&drole&d")) out=_tmp_empd; 17238 + by datarole &EM_REPORT_KEY_X; 17239 + run; 17241 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 17242 + title4 "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitlethree_title, NOQUOTE, &&&drole&d))"; 17244 + proc sgplot data=_tmp_empd; 17245 + series x=&EM_REPORT_KEY_X y=&EM_REPORT_KEY_Y ; 17246 + series x=&EM_REPORT_KEY_X y=&EM_REPORT_KEY_Y2 / y2axis ; 17247 + %if "&EM_REPORT_KEY_YREF" ne "" %then %do; refline &EM_REPORT_KEY_YREF / axis = y; %end; 17248 + %if "&EM_REPORT_KEY_Y2REF" ne "" %then %do; refline &EM_REPORT_KEY_Y2REF / axis = y2; %end; 17249 + run; quit; 17250 + %end; 17251 + %end; 17252 + %else %do; 17253 + title1 "&EM_REPORT_TTL1"; title2 "&EM_REPORT_TTL2"; title3 "&EM_REPORT_TTL3"; 17254 + proc sgplot data=_tmp_dat; 17255 + series x=&EM_REPORT_KEY_X y=&EM_REPORT_KEY_Y ; 17256 + series x=&EM_REPORT_KEY_X y=&EM_REPORT_KEY_Y2 / y2axis ; 17257 + %if "&EM_REPORT_KEY_YREF" ne "" %then %do; refline &EM_REPORT_KEY_YREF / axis = y; %end; 17258 + %if "&EM_REPORT_KEY_Y2REF" ne "" %then %do; refline &EM_REPORT_KEY_Y2REF / axis = y2; %end; 17259 + run; quit; 17260 + %end; 17262 + title1; title2; title3; title4; 17264 +%mend EM_REPORT_MULTIPLY2PLOT; NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.REPORTER_PRINTMACROS.SOURCE. 17265 +/*---------------------------------------------------------*/ 17266 + * EM_REPORT_NODE_TEXT ; 17267 + * return the text label for a given node ; 17268 +/*---------------------------------------------------------*/ 17270 +%macro EM_REPORT_NODE_TEXT(nodeid); 17271 + %global EM_REPORT_NODE_TEXT ; 17272 + %if not %sysfunc(exist(&em_report_lib..EM_NODEID)) %then %goto skip ; 17273 + data _null_ ; 17274 + set &em_report_lib..EM_NODEID ; 17275 + where upcase(strip(nodeid)) eq upcase(strip("&nodeid")) ; 17276 + call symput("EM_REPORT_NODE_TEXT",strip(tranwrd(label,'"',''))); 17277 + run; 17278 + %skip: 17279 +%mend EM_REPORT_NODE_TEXT; 17281 +/*---------------------------------------------------------*/ 17282 + * EM_REPORT_TABLETEXT; 17283 + * print the ods texts in front of a table; 17284 +/*---------------------------------------------------------*/ 17286 +%macro EM_REPORT_TABLETEXT(subtitle=); 17287 +%if %substr(%upcase(%sysfunc(strip(&subtitle))), 1, 19) eq VIEWS_DESCRIPTIONS_ %then %do; 17288 + ods &EM_REPORT_FORMAT text=" "; 17289 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text)))"; 17290 + %let thisDVD = dmine; 17292 + %let msg0 = views_descriptions_&em_report_key_description; 17293 + %let msg1 = %sysfunc(sasmsg(sashelp.dmine, views_descriptions_&em_report_key_description, NOQUOTE)); 17294 + %if %sysfunc(exist(sashelp.tmine)) %then %do; 17295 + %let msg2 = %sysfunc(sasmsg(sashelp.tmine, views_descriptions_&em_report_key_description, NOQUOTE)); 17296 + %end; 17297 + %else %do; 17298 + %let msg2=views_descriptions_&em_report_key_description; 17299 + %end; 17301 + %if "%sysfunc(strip(%nrstr(&msg1)))" ne "%sysfunc(strip(&msg0))" 17302 + %then %do; 17303 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, views_descriptions_&em_report_key_description, NOQUOTE))"; 17304 + %end; 17305 + %else %if "%sysfunc(strip(%nrstr(&msg2)))" ne "%sysfunc(strip(&msg0))" 17306 + %then %do; 17307 + %if %sysfunc(exist(sashelp.tmine)) %then %do; 17308 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.tmine, views_descriptions_&em_report_key_description, NOQUOTE))"; 17309 + %let thisDVD = tmine; 17310 + %end; 17311 + %end; 17312 + %else %do; 17313 + ods &EM_REPORT_FORMAT text="&em_report_key_description"; 17314 + %end; 17316 + ods proclabel = "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text))) %sysfunc(sasmsg(sashelp.&thisDVD, &subtitle, NOQUOTE))"; 17317 +%end; 17318 +%else %do; 17319 + %let msg1 = %sysfunc(sasmsg(sashelp.dmine, &subtitle, NOQUOTE)); 17320 + %if %sysfunc(exist(sashelp.tmine)) %then %do; 17321 + %let msg2 = %sysfunc(sasmsg(sashelp.tmine, &subtitle, NOQUOTE)); 17322 + %end; 17323 + %else %do; 17324 + %let msg2=%sysfunc(sasmsg(sashelp.dmine, &subtitle, NOQUOTE)); 17325 + %end; 17327 + %if "%sysfunc(strip(%nrstr(&msg1)))" ne "%sysfunc(strip(&subtitle))" 17328 + %then %do; 17329 + %let thisDVD = dmine; 17330 + %end; 17331 + %else %if "%sysfunc(strip(%nrstr(&msg2)))" ne "%sysfunc(strip(&subtitle))" 17332 + %then %do; 17333 + %let thisDVD = tmine; 17334 + %end; 17335 + %else %do; 17336 + %let thisDVD = dmine; 17337 + %end; 17339 + ods &EM_REPORT_FORMAT text=" "; 17340 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text)))"; 17341 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.&thisDVD, &subtitle, NOQUOTE))"; 17342 + ods proclabel = "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text))) %sysfunc(sasmsg(sashelp.&thisDVD, &subtitle, NOQUOTE))"; 17343 +%end; 17344 +%mend EM_REPORT_TABLETEXT; 17346 +/*---------------------------------------------------------*/ 17347 + * Print comparison of model fit stats; 17348 + * used by EM_REPORT_DATA(); 17349 +/*---------------------------------------------------------*/ 17351 +%macro EM_REPORT_COMPAREFIT(data=) ; 17352 + proc sort data=&data out=sd(drop=stat) ; 17353 + by target datarole ; 17354 + run ; 17355 + %EM_REPORT_TABLETEXT(subtitle=rpt_modelfitcomparison_title); 17356 + proc print data=sd noobs label contents='' ; 17357 + by target datarole ; 17358 + label label="%sysfunc(sasmsg(sashelp.dmine, rpt_dmneural_label_stat, NOQUOTE))"; 17359 + run; 17360 +%mend EM_REPORT_COMPAREFIT; 17362 +/*---------------------------------------------------------*/ 17363 + * EM_REPORT_CLASSIFYTABT; 17364 + * print the table in a lattice plot of classification charts; 17365 +/*---------------------------------------------------------*/ 17367 +%macro EM_REPORT_CLASSIFYTAB(); 17369 + %if "&em_report_key_whereclause" eq "" %then %do ; 17370 + %EM_REPORT_TABLETEXT(subtitle=rpt_eventclassification_title); 17371 + %end; %else %do; 17372 + ods &EM_REPORT_FORMAT text=" "; 17373 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text)))"; 17374 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_eventclasswhere_title, NOQUOTE, &em_report_key_where))"; 17375 + ods proclabel = "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitletwo_title, NOQUOTE, %nrbquote(&em_report_node_text))) %sysfunc(sasmsg(sashelp.dmine, rpt_eventclasswhere_title, NOQUOTE, &em_report_key_where))"; 17376 + %end; 17378 + %let pdat = &EM_REPORT_LIB..&EM_REPORT_KEY_FILE; 17380 + proc print data=&pdat.&EM_REPORT_KEY_WHERECLAUSE noobs label contents=''; 17381 + label CORRECTTEXT= "%sysfunc(sasmsg(sashelp.dmine, rpt_state_vlabel, NOQUOTE))" percent="%sysfunc(sasmsg(sashelp.dmine, rpt_percent_vlabel, NOQUOTE))" ; 17382 + by target datarole ; 17383 + var from into correcttext count percent ; 17384 + run; 17386 +%mend EM_REPORT_CLASSIFYTAB; 17388 +/*---------------------------------------------------------*/ 17389 + * EM_REPORT_PROPERTIES; 17390 + * print the properties table; 17391 +/*---------------------------------------------------------*/ 17393 +%macro EM_REPORT_PROPERTIES(catalog=, dsname=work.properties); 17394 + %if %sysfunc(cexist(&catalog)) %then %do; 17395 + proc display cat=sashelp.emutil.prop2Ds.scl; 17396 + run; 17397 + %EM_REPORT_TABLETEXT(subtitle=rpt_props_title); 17398 + %EM_REPORT_makeMultiColumn(dat=work.properties, vars=name value default, split=3); 17399 + proc delete data=work.properties; run; quit; 17400 + %end; 17401 +%mend EM_REPORT_PROPERTIES; 17403 +/*---------------------------------------------------------*/ 17404 + * EM_REPORT_DATASOURCE ; 17405 + * Report on data set starting a flow ; 17406 +/*--------------------------------------------------------*/ 17407 +%macro EM_REPORT_DATASOURCE(); 17409 + proc transpose data=&EM_REPORT_LIB..&EM_REPORT_NODEID._EMTMETADEFAULT out=temp_source; 17410 + var _all_; 17411 + format crdate NLDATM24.0 modate NLDATM24.0; 17412 + run; 17414 + /* prepare the data source table */ 17415 + data temp_source; 17416 + set temp_source; 17417 + rename col1 = value; 17418 + col1 = right(col1); 17419 + format label $64.; 17420 + label 17421 + col1 = "%sysfunc(sasmsg(sashelp.dmine, rpt_value_vlabel, NOQUOTE))" 17422 + label = "%sysfunc(sasmsg(sashelp.dmine, rpt_attribute_vlabel, NOQUOTE))" 17423 + ; 17424 + *** get the localized label column; 17425 + _name_=upcase(_name_) ; 17426 + if _name_ eq "MEMNAME" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_dataname_vlabel, NOQUOTE))" ; 17427 + if _name_ eq "MEMTYPE" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_datatype_vlabel, NOQUOTE))" ; 17428 + if _name_ eq "MEMLABEL" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_datalabel_vlabel, NOQUOTE))" ; 17429 + if _name_ eq "TYPEMEM" then delete ; 17430 + if _name_ eq "ENGINE" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_engine_vlabel, NOQUOTE))" ; 17431 + if _name_ eq "CRDATE" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_crdate_vlabel, NOQUOTE))" ; 17432 + if _name_ eq "MODATE" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_datemode_vlabel, NOQUOTE))" ; 17433 + if _name_ eq "NOBS" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_numrows_vlabel, NOQUOTE))" ; 17434 + if _name_ eq "NCOLS" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_numcols_vlabel, NOQUOTE))" ; 17435 + if _name_ eq "NBYTES" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_datasize_vlabel, NOQUOTE))" ; 17436 + if _name_ eq "ROLE" then label="%sysfunc(sasmsg(sashelp.dmine, meta_role_vlabel, NOQUOTE))" ; 17437 + if _name_ eq "USEEXTERNALDATA" then delete ; 17438 + if _name_ eq "SAMPLINGRATE" then delete ; 17439 + if _name_ eq "SEGMENT" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_segment_vlabel, NOQUOTE))" ; 17440 + if _name_ eq "LIBNAME" then label="%sysfunc(sasmsg(sashelp.dmine, rpt_datalib_vlabel, NOQUOTE))" ; 17441 + run; 17443 + %EM_REPORT_TABLETEXT(subtitle=rpt_dataattributes_title); 17444 + %EM_REPORT_makeMultiColumn(dat=temp_source, vars=label value, split=3); 17445 + proc delete data=temp_source; run; quit; 17447 +%mend EM_REPORT_DATASOURCE ; 17449 +*---------------------------------------------------------*/ 17450 + * a utility macro for split table into multiple columns ; 17451 +/*---------------------------------------------------------*/ 17453 +%macro em_report_makeMultiColumn(dat=,vars=,split=2); 17455 + %let vars = %upcase(&vars); 17457 + /*--- check if the variable existing in the table ---*/ 17458 + proc contents data=&dat out=_tmpms_content(keep=name) noprint; 17459 + run; 17461 + %let k = 1; 17462 + %let vars2 = ; 17463 + %do %while("%scan(&vars,&k,' ')" ne ""); 17464 + data _null_; 17465 + set _tmpms_content; 17466 + name=strip(upcase(name)); 17467 + if name eq "%scan(&vars,&k,' ')" 17468 + then call symput('vars2',catx(' ',symget('vars2'),name)); 17469 + run; 17470 + %let k = %eval(&k+1); 17471 + %end; 17473 + /*--- count the valid variables ---*/ 17474 + %let k = 1; 17475 + %do %while("%scan(&vars2,&k,' ')" ne ""); 17476 + %let var&k = %scan(&vars2,&k,' '); 17477 + %let k = %eval(&k+1); 17478 + %end; 17479 + %let numvars = %eval(&k-1); 17481 + /* --- split the table ---*/ 17482 + %let dsid = %sysfunc(open(&dat)); 17483 + %let numobs = %sysfunc(attrn(&dsid, NOBS)); 17484 + %let numrows = %sysfunc(round(%sysevalf(&numobs/&split))); 17485 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 17487 + data %do d = 1 %to &split; _tmpms_dat&d.(rename=(%do k = 1 %to &numvars; &&&var&k=&&&var&k..&d %end;)) %end;; 17488 + set &dat; 17489 + keep &vars2 numrow; 17490 + %do d = 1 %to &split; 17491 + if _n_ gt %eval(&numrows*(&d-1)) and _n_ le %eval(&numrows*&d) 17492 + then do; numrow = _n_-&numrows*(&d-1); output _tmpms_dat&d; end; 17493 + %end; 17494 + run; 17496 + %do d = 1 %to &split; 17497 + proc sort data=_tmpms_dat&d; by numrow; run; 17498 + %end; 17500 + /*--- merge and print ---*/ 17501 + data _tmpms_alldat; 17502 + merge %do d = 1 %to &split; _tmpms_dat&d %end;; 17503 + by numrow; 17504 + run; 17506 + proc print data=_tmpms_alldat noobs label contents=''; 17507 + var %do d = 1 %to &split; %do k = 1 %to &numvars; &&&var&k..&d %end; %end;; 17508 + run; 17510 + proc datasets lib=work nolist; 17511 + delete _tmpms_:; 17512 + run; quit; 17514 +%mend em_report_makeMultiColumn; 17516 +*---------------------------------------------------------*/ 17517 + * basic print a data table ; 17518 +/*---------------------------------------------------------*/ 17519 +%macro EM_REPORT_DATA(maxobs=100); 17521 +%local pd desc ; 17522 +%let pd=&em_report_lib..&EM_REPORT_KEY_FILE ; 17523 +%IF not %SYSFUNC(EXIST(&pd)) %then %goto skip; 17525 +%if (("&EM_REPORT_KEY_AUTODISPLAY" eq "Y") OR ("&EM_REPORT_SHOWALL" eq "Y")) %then %do; 17527 + %let desc= %upcase(&em_report_key_description) ; 17529 + %if "&desc" eq "VARIABLES" %then %do; 17530 + /*--- NOOP: handled globally by EM_REPORT_NODE --*/ 17531 + %goto skip ; 17532 + %end; 17533 + %else %if (("&desc" eq "ITEMS") OR ("&desc" eq "OUTAOV16") OR ("&desc" eq "OUTGINT") OR ("&desc" eq "OUTGVAR") 17534 + OR ("&desc" eq "HISTWEIGHT") OR ("&desc" eq "EMSTAT")) %then %do;; 17535 + %goto skip; 17536 + %end; 17537 + %if (("&desc" eq "SAMPLE") AND (%substr(%upcase(%sysfunc(strip(&nodeid))), 1, 7) eq GRFEXPL)) %then %do;; 17538 + %goto skip; 17539 + %end; 17540 + %else %if "&desc" eq "MODELDIAGNOSTICS" %then %do; 17542 + %EM_REPORT_TABLETEXT(subtitle=views_descriptions_&em_report_key_description); 17544 + proc print data=&pd(obs=&maxobs) noobs label contents=''; 17545 + by datarole; 17546 + var cutoff sensitivity_tpr specificity_tnr one_specificity_fpr precision_event 17547 + precision_non_event ovl_class_rate precision_overall; 17548 + run ; 17549 + %end; 17550 + %else 17551 + %if "&desc" eq "REPORTFITSTAT" %then %do ; 17553 + /*--- should switch to proc tabulate ---*/ 17554 + /*--- often there is only one value of the by variable 'target', but there may be several ---*/ 17555 + data pd; set &pd ; 17556 + where train ne . ; 17557 + label _NOBS_ = "%sysfunc(sasmsg(sashelp.dmine, stat_nobs_vlabel, NOQUOTE))" 17558 + _MISC_ = "%sysfunc(sasmsg(sashelp.dmine, stat_misc_vlabel, NOQUOTE))" 17559 + _MAX_ = "%sysfunc(sasmsg(sashelp.dmine, stat_max_vlabel, NOQUOTE))" 17560 + _SSE_ = "%sysfunc(sasmsg(sashelp.dmine, stat_sse_vlabel, NOQUOTE))" 17561 + _ASE_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_ase, NOQUOTE))" 17562 + _RASE_ = "%sysfunc(sasmsg(sashelp.dmine, stat_rase_vlabel, NOQUOTE))" 17563 + _DIV_ = "%sysfunc(sasmsg(sashelp.dmine, stat_div_vlabel, NOQUOTE))" 17564 + _DFT_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_dft, NOQUOTE))" 17565 + _AIC_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_aic, NOQUOTE))" 17566 + _MSE_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_mse, NOQUOTE))" 17567 + _RMSE_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_rmse, NOQUOTE))" 17568 + _AVERR_ = "%sysfunc(sasmsg(sashelp.dmine, stat_averr_vlabel, NOQUOTE))" 17569 + _DFE_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_dfe, NOQUOTE))" 17570 + _DFM_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_dfm, NOQUOTE))" 17571 + _ERR_ = "%sysfunc(sasmsg(sashelp.dmine, stat_err_vlabel, NOQUOTE))" 17572 + _FPE_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_fpe, NOQUOTE))" 17573 + _NW_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_nw, NOQUOTE))" 17574 + _RFPE_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_rfpe, NOQUOTE))" 17575 + _SBC_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_sbc, NOQUOTE))" 17576 + ; 17577 + drop stat ; 17578 + run; 17580 + %EM_REPORT_TABLETEXT(subtitle=rpt_modelfitstat_title); 17582 + proc sort data=pd; 17583 + by target targetlabel; 17584 + proc print data=pd noobs label contents=''; 17585 + label label="%sysfunc(sasmsg(sashelp.dmine, rpt_dmneural_label_statlabel, NOQUOTE))" ; 17586 + by target targetlabel; 17587 + run; 17589 + %end ; 17590 + %else %if "&desc" eq "CLUSMEAN" %then %do; 17592 + /* determine number of segments to process */ 17593 + %let dsid = %sysfunc(open(&pd)); 17594 + %if &dsid %then %do; 17595 + %let numseg = %sysfunc(ATTRN(&dsid, NOBS)); 17596 + %end; 17597 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 17599 + /* transpose data to have a row per segment value */ 17600 + proc transpose data=&pd out=clusmean name=VARIABLE; 17601 + run; 17603 + data clusmean; 17604 + set clusmean; 17605 + label _LABEL_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_variable_vlabel, NOQUOTE))" 17606 + %do i=1 %to &numseg; 17607 + %let colname = COL&i; 17608 + &colname = "%sysfunc(sasmsg(sashelp.dmine, rpt_segcolname_vlabel, NOQUOTE, &i))" 17609 + %end; 17610 + ; 17611 + if missing(_LABEL_) then _LABEL_ = VARIABLE; 17612 + if VARIABLE="_SEGMENT_" then delete; 17613 + drop VARIABLE; 17614 + run; 17616 + %EM_REPORT_TABLETEXT(subtitle=rpt_meanstats_title); 17617 + proc print data=clusmean noobs label contents='' ; run ; 17619 + %end; 17620 + %else %if "&desc" eq "COMPAREFIT" %then %do; 17622 + %EM_REPORT_COMPAREFIT(data=&pd); 17624 + %end; 17625 + %else %if "&desc" eq "FITSTAT" %then %do; 17627 + /*** only print the fitstat table for MDLCOMP nodes ***/ 17628 + %if %substr(%upcase(%sysfunc(strip(&nodeid))), 1, 7) eq MDLCOMP %then %do; 17630 + data _null_ ; 17631 + set &pd (obs=2) end=eof ; 17632 + if eof then do ; 17633 + call symput("_misc_" , strip(put(_misc_,best.))) ; 17634 + call symput("_vmisc_" , strip(put(_vmisc_,best.))) ; 17635 + call symput("_aur_" , strip(put(_aur_, best.))); 17636 + call symput("_gini_" , strip(put(_gini_, best.))); 17637 + end; 17638 + run; 17640 + %let loopflag = 0; %let validflag = 0; 17641 + %let ASEflag = 0; %let VASEflag = 0; %let MISCflag = 0; %let VMISCflag = 0; 17642 + %let KSflag = 0; %let VKSflag = 0; %let AURflag = 0; %let GINIflag = 0; 17643 + %let dsid = %sysfunc(open(&pd)); 17644 + %if &dsid %then %do; 17645 + %let loopflag = %sysfunc(VARNUM(&dsid, _LOOP_)); 17646 + %let validflag = %sysfunc(VARNUM(&dsid, VKS)); 17647 + %let ASEflag = %sysfunc(VARNUM(&dsid, _ASE_)); 17648 + %let MISCflag = %sysfunc(VARNUM(&dsid, _MISC_)); 17649 + %let KSflag = %sysfunc(VARNUM(&dsid, KS)); 17650 + %let VASEflag = %sysfunc(VARNUM(&dsid, _VASE_)); 17651 + %let VMISCflag = %sysfunc(VARNUM(&dsid, _VMISC_)); 17652 + %let VKSflag = %sysfunc(VARNUM(&dsid, VKS)); 17653 + %let AURflag = %sysfunc(VARNUM(&dsid, _AUR_)); 17654 + %let GINIflag = %sysfunc(VARNUM(&dsid, _GINI_)); 17655 + %end; 17656 + %if &dsid %then %let dsid=%sysfunc(close(&dsid)); 17658 + %EM_REPORT_TABLETEXT(subtitle=rpt_fittable_title); 17660 + proc print data=&pd(obs=&maxobs) noobs label contents=''; 17661 + id 17662 + %if &loopflag ne 0 %then %do; _LOOP_ _WHERE_ %end; 17663 + USE PARENT MODEL MODELDESCRIPTION TARGET TARGETLABEL _CRITERION_ 17664 + ; 17665 + var 17666 + %if &validflag ne 0 %then %do; 17667 + %if &ASEflag ne 0 %then %do; _ASE_ %end; 17668 + %if &MISCflag ne 0 and "&_misc_" ne "." %then %do; _MISC_ %end; 17669 + %if &KSflag ne 0 %then %do; KS %end; 17670 + %if &VASEflag ne 0 %then %do; _VASE_ %end; 17671 + %if &VMISCflag ne 0 and "&_vmisc_" ne "." %then %do; _VMISC_ %end; 17672 + %if &VKSflag ne 0 %then %do; VKS %end; 17673 + %end; 17674 + %else %do; 17675 + %if &ASEflag ne 0 %then %do; _ASE_ %end; 17676 + %if &MISCflag ne 0 and "&_misc_" ne "." %then %do; _MISC_ %end; 17677 + %if &KSflag ne 0 %then %do; KS %end; 17678 + %if &AURflag ne 0 and "&_aur_" ne "." %then %do; _AUR_ %end; 17679 + %if &GINIflag ne 0 and "&_gini_" ne "." %then %do; _GINI_ %end; 17680 + %end; 17681 + ; 17682 + run; 17683 + %end; 17684 + %else %do; 17685 + %goto skip; 17686 + %end; 17687 + %end; 17688 + %else %if "&desc" eq "RULETABLE" %then %do; 17690 + %let dsid = %sysfunc(open(&pd)); 17691 + %let printflag = 0; 17692 + %if &dsid %then %do; 17693 + %let printflag = %sysfunc(VARNUM(&dsid, EXP_CONF)); 17694 + %let lhandflag = %sysfunc(VARNUM(&dsid, _lhand)); 17695 + %let rhandflag = %sysfunc(VARNUM(&dsid, _rhand)); 17696 + %end; 17697 + %if &dsid %then %let dsid=%sysfunc(close(&dsid)); 17699 + %EM_REPORT_TABLETEXT(subtitle=views_descriptions_&em_report_key_description); 17701 + proc print data=&pd(obs=&maxobs) noobs label contents=''; 17702 + %if &printflag ne 0 %then %do; 17703 + var rule exp_conf support lift count 17704 + %if &lhandflag ne 0 %then %do; _lhand %end; 17705 + %if &rhandflag ne 0 %then %do; _rhand %end; 17706 + ; 17707 + %end; 17708 + %else %do; 17709 + var rule conf support count 17710 + %if &lhandflag ne 0 %then %do; _lhand %end; 17711 + %if &rhandflag ne 0 %then %do; _rhand %end; 17712 + ; 17713 + %end; 17714 + run; 17715 + %end; 17716 + %else %do ; 17717 + %EM_REPORT_TABLETEXT(subtitle=views_descriptions_&em_report_key_description); 17718 + proc print data=&pd(obs=&maxobs) noobs label contents=''; run ; 17719 + %end ; 17720 + %end; 17721 +%skip: 17722 +%mend EM_REPORT_DATA; 17724 +/*---------------------------------------------------------*/ 17725 + * EM_REPORT_VARS ; 17726 + * EM_REPORT_VARS_FLIP ; 17727 + * Report on variables used by the node ; 17728 +/*---------------------------------------------------------*/ 17729 +%macro EM_REPORT_VARS_FLIP(data=,out=); 17731 + proc sort data=&data; 17732 + by descending role level name; 17733 + run; 17735 + data &out(keep=role level count names ) ; 17736 + length role level $16 ; 17737 + set &data end=eof ; 17738 + length xrole role $32 count 8 names $200 ; 17739 + krole= strip(role) !!' * ' !! strip(level) ; 17740 + retain xrole ; if _n_ eq 1 then xrole=krole ; 17741 + retain names ; if _n_ eq 1 then names=name ; 17742 + retain count 0 ending 0 ; 17743 + count+1 ; 17744 + role=scan(xrole,1,'*') ; 17745 + level=scan(xrole,2,'*') ; 17746 + if xrole ne krole then do ; 17747 + count=count-1 ; 17748 + put _n_ "OUTPUT;" ; 17749 + output ; 17750 + xrole=krole ; names= strip(name) ; 17751 + count=1 ; ending=0 ; 17752 + end ; 17753 + else if _n_ gt 1 then do ; 17754 + if length(names) + length(name) lt 196 then 17755 + names= strip(names) !! ' ' !! strip(name) ; 17756 + else 17757 + if not ending then do ; 17758 + names= strip(names) !! ' ...' ; 17759 + ending=1 ; 17760 + end; 17761 + end; 17762 + role=scan(xrole,1,'*') ; 17763 + level=scan(xrole,2,'*') ; 17764 + if eof and count gt 0 then output ; 17765 + label count = "%sysfunc(sasmsg(sashelp.dmine, rpt_count_vlabel, NOQUOTE)) " 17766 + names = "%sysfunc(sasmsg(sashelp.dmine, rpt_varsel_label_name, NOQUOTE))" 17767 + level = "%sysfunc(sasmsg(sashelp.dmine, rpt_level_vlabel, NOQUOTE))" 17768 + role = "%sysfunc(sasmsg(sashelp.dmine, meta_role_vlabel, NOQUOTE))"; 17769 + run ; 17770 +%mend EM_REPORT_VARS_FLIP ; 17772 +%macro EM_REPORT_VARS(varlist=0); 17774 + %if not %sysfunc(exist(&EM_REPORT_LIB..&EM_REPORT_NODEID._EMTRAINVARIABLE)) 17775 + %then %goto skip ; 17777 + proc sql noprint; 17778 + select count(*) into :tmp_numvar from &EM_REPORT_LIB..&EM_REPORT_NODEID._EMTRAINVARIABLE; 17779 + quit; 17781 + %if &tmp_numvar lt 1 %then %goto skip; 17782 +/*--- 1. get minimal set of vars -----------------------------------------*/ 17784 + data _tmpvl_pdv(drop=use newuse count) ; 17785 + set &EM_REPORT_LIB..&EM_REPORT_NODEID._EMTRAINVARIABLE end=eof; 17786 + length use newuse $1; 17787 + label 17788 + name = "%sysfunc(sasmsg(sashelp.dmine, rpt_varsel_label_name, NOQUOTE))" 17789 + level = "%sysfunc(sasmsg(sashelp.dmine, rpt_level_vlabel, NOQUOTE))" 17790 + role = "%sysfunc(sasmsg(sashelp.dmine, meta_role_vlabel, NOQUOTE))" 17791 + length = "%sysfunc(sasmsg(sashelp.dmine, meta_length_vlabel, NOQUOTE))" 17792 + ; 17793 + if use eq "" then use="Y"; 17794 + newuse=use; 17795 + if use eq "D" then do; 17796 + if role="REJECT" then newuse="N"; 17797 + else if role="INPUT" then newuse="Y"; 17798 + else if role="CROSSID" then newuse="Y"; 17799 + else if role="TEXT" then newuse="Y"; 17800 + end ; 17801 + if newuse eq "Y" then do ; 17802 + count+1 ; 17803 + output; 17804 + end; 17805 + if eof then call symput("varcount",put(count,6.)) ; 17806 + run; 17808 + proc sort data=_tmpvl_pdv; by name; run ; 17810 +/*--- 2. Summarize the variables -----------------------------------------*/ 17812 + %if &varlist ne 1 or &varcount gt &EM_REPORT_PRINT_MAXVARS %then %do; 17814 + /* why not update pdv here? mxx */ 17815 + %EM_REPORT_VARS_FLIP(data=_tmpvl_pdv,out=_tmpvl_pds); 17816 + %EM_REPORT_TABLETEXT(subtitle=rpt_varsummary_title); 17817 + proc print data=_tmpvl_pds noobs label contents=''; run; 17819 + %end; 17820 + %else %do; 17822 + %if %sysfunc(exist(&EM_REPORT_LIB..&EM_REPORT_NODEID._variableset)) %then %do; 17823 + proc sort data=&EM_REPORT_LIB..&EM_REPORT_NODEID._variableset out=_tmpvl_vs; 17824 + by name; 17825 + data _tmpvl_pdv; 17826 + update _tmpvl_pdv _tmpvl_vs; 17827 + by name; 17828 + label 17829 + type = "%sysfunc(sasmsg(sashelp.dmine, meta_type_vlabel, NOQUOTE))" 17830 + format = "%sysfunc(sasmsg(sashelp.dmine, meta_format_vlabel, NOQUOTE))" 17831 + creator = "%sysfunc(sasmsg(sashelp.dmine, meta_creator_vlabel, NOQUOTE))" 17832 + family = "%sysfunc(sasmsg(sashelp.dmine, rpt_family_vlabel, NOQUOTE))" 17833 + label = "%sysfunc(sasmsg(sashelp.dmine, meta_label_vlabel, NOQUOTE))" 17834 + ; 17835 + run; 17836 + %end; 17838 + %EM_REPORT_TABLETEXT(subtitle=rpt_varlist_title); 17839 + proc print data=_tmpvl_pdv noobs label contents=''; 17840 + var name label role level type length format creator; 17841 + run; 17842 + %end; 17844 +/*--- 3. for SVM node with EMSTAT table ----------------------------------*/ 17846 + %let emstat_exist = 0; 17847 + %if %sysfunc(exist(&EM_REPORT_LIB..&EM_REPORT_NODEID._emstat)) %then %do; 17848 + proc sql noprint; 17849 + select count(*) into :emstat_use from &em_report_lib..&nodeid._emreport 17850 + where key="DESCRIPTION" and value="EMSTAT" ; 17851 + quit; 17852 + %if &emstat_use gt 0 %then %let emstat_exist = 1; 17853 + %end; 17855 + %if &emstat_exist eq 1 %then %do; 17857 + /* check newname column */ 17858 + %let newname_exist = 0; 17859 + %let newobs = 0; 17860 + %let tsdsid = %sysfunc(open(work.pdv)); 17861 + %if &tsdsid %then %do; 17862 + %let tsobs = %sysfunc(ATTRN(&tsdsid, NOBS)); 17863 + %let newobs = %sysfunc(varnum(&tsdsid, NEWNAME)); 17864 + %if &tsobs > 0 AND &newobs > 0 %then %let newname_exist =1; 17865 + %end; 17866 + %if &tsdsid %then %let tsdsid = %sysfunc(close(&tsdsid)); 17868 + %if &newname_exist eq 1 %then %do; 17869 + data _tmpvl_pdv; set _tmpvl_pdv(drop=name); run; 17870 + proc sort data=_tmpvl_pdv(rename=(newname=NAME)); by name; run; 17871 + %end; 17872 + %else %do; 17873 + proc sort data=_tmpvl_pdv; by name; run; 17874 + %end; 17876 + proc sort data=&EM_REPORT_LIB..&EM_REPORT_NODEID._VARIABLESET out=_tmpvl_v; by name; run; 17878 + data _tmpvl_pdv ; 17879 + update _tmpvl_pdv _tmpvl_v; 17880 + by name; 17881 + label label="%sysfunc(sasmsg(sashelp.dmine, meta_label_vlabel, NOQUOTE))"; 17882 + run; 17884 + proc sort data=_tmpvl_pdv; by name; run; 17885 + proc sort data=&EM_REPORT_LIB..&EM_REPORT_NODEID._EMSTAT out=_tmpvl_tempsort; by name; run; 17887 + data _tmpvl_pdv; 17888 + merge _tmpvl_pdv(keep=name label role level type length format creator family) _tmpvl_tempsort; 17889 + by name; 17890 + label type = "%sysfunc(sasmsg(sashelp.dmine, meta_type_vlabel, NOQUOTE))" 17891 + format = "%sysfunc(sasmsg(sashelp.dmine, meta_format_vlabel, NOQUOTE))" 17892 + creator = "%sysfunc(sasmsg(sashelp.dmine, meta_creator_vlabel, NOQUOTE))" 17893 + family = "%sysfunc(sasmsg(sashelp.dmine, rpt_family_vlabel, NOQUOTE))"; 17894 + run; 17896 + proc sort data=_tmpvl_pdv; by descending role name; run; 17898 + %EM_REPORT_TABLETEXT(subtitle=rpt_variable_interval_title); 17899 + proc print data=_tmpvl_pdv(where=(LEVEL="INTERVAL")) noobs label contents=''; 17900 + var name label role level type length format creator pctmiss min max mean std skewness kurtosis; 17901 + run; 17903 + %EM_REPORT_TABLETEXT(subtitle=rpt_variable_class_title); 17904 + proc print data=_tmpvl_pdv(where=(LEVEL^="INTERVAL")) noobs label contents=''; 17905 + var name label role level type length format creator nlevel pctmiss; 17906 + run; 17907 + %end; 17909 +/*--- 4. now get vars created by this node -------------------------------*/ 17911 + %if not %sysfunc(exist(&EM_REPORT_LIB..&EM_REPORT_NODEID._CMETA_TRAIN)) 17912 + %then %goto skip; 17914 + %let pdvxnum = 0; 17916 + data _tmpvl_pdvx; 17917 + set &EM_REPORT_LIB..&EM_REPORT_NODEID._CMETA_TRAIN end=eof ; 17918 + where upcase(creator) eq "&EM_REPORT_NODEID" ; 17919 + if eof then call symput('pdvxnum',put(_N_,6.)); 17920 + label 17921 + name = "%sysfunc(sasmsg(sashelp.dmine, rpt_varsel_label_name, NOQUOTE))" 17922 + label = "%sysfunc(sasmsg(sashelp.dmine, meta_label_vlabel, NOQUOTE))" 17923 + role = "%sysfunc(sasmsg(sashelp.dmine, meta_role_vlabel, NOQUOTE))" 17924 + level = "%sysfunc(sasmsg(sashelp.dmine, rpt_level_vlabel, NOQUOTE))" 17925 + type = "%sysfunc(sasmsg(sashelp.dmine, rpt_type_vlabel, NOQUOTE))" 17926 + length = "%sysfunc(sasmsg(sashelp.dmine, meta_length_vlabel, NOQUOTE))"; 17927 + run; 17929 + %if pdvxnum gt 0 %then %do; 17930 + %if &varlist ne 1 or &pdvxnum gt &EM_REPORT_PRINT_MAXVARS %then %do ; 17932 + %EM_REPORT_VARS_FLIP(data=_tmpvl_pdvx,out=_tmpvl_pdvxp) ; 17934 + proc sql noprint; 17935 + select count(*) into :nobs from _tmpvl_pdvxp; 17936 + quit; 17938 + %if &nobs > 0 %then %do; 17939 + %EM_REPORT_TABLETEXT(subtitle=rpt_createvarsummary_title); 17940 + proc print data=_tmpvl_pdvxp noobs label contents=''; run ; 17941 + %end; 17942 + %end; 17943 + %else %do ; 17945 + %EM_REPORT_TABLETEXT(subtitle=rpt_createvarslist_title); 17946 + proc print data=_tmpvl_pdvx noobs label contents=''; 17947 + var name label role type length ; 17948 + run; 17949 + %end; 17950 + %end; 17952 +/*------------------------------------------------------------------------*/ 17954 + proc datasets lib=work nolist; 17955 + delete _tmpvl_:; 17956 + run; quit; 17957 + %skip: 17959 +%mend EM_REPORT_VARS; NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.REPORTER_RPMMACROS.SOURCE. 17961 +%macro EM_REPORT_validSummaryPath(startNodeID =); 17962 +/*--- purpose: detect whether a flow is valid as a summary path ---*/ 17964 + %global EM_REPORT_NODES EM_REPORT_LIB RPM_REPORT_MODELNODE RPM_REPORT_SCORENODE RPM_REPORT_MDLCOMP RPM_REPORT_VALIDSUMMARY; 17965 + %local prednode em_report_mdlOutfit; 17966 + %let RPM_REPORT_MODELNODE = ; 17967 + %let RPM_REPORT_SCORENODE = ; 17968 + %let RPM_REPORT_MDLCOMP = ; 17969 + %let RPM_REPORT_VALIDSUMMARY = 0; 17971 + %if &EM_REPORT_NODES eq SUMMARY %then %do; 17973 + %let predNode=; 17974 + data _null_ ; 17975 + set &EM_REPORT_LIB..em_dgraph(where=(to="&startNodeID")); 17976 + call symput('predNode', strip(from)); 17977 + run; 17978 + %let predNode = &predNode; 17980 + /* if predecessor is MDLCOMP, RPM report is valid */ 17981 + /* or if predecessor is SCORE and MODEL node is fed into score, RPM report is valid */ 17982 + /* or if MDLCOMP to SCORE to REPORTER, RPM report is valid, commented xxm */ 17983 + /* or if predecessor is MODEL node, RPM report is valid */ 17985 + %if %upcase(%substr(&prednode,1,7)) eq MDLCOMP %then %do; 17986 + %let RPM_REPORT_MDLCOMP = &predNode; 17987 + %let RPM_REPORT_VALIDSUMMARY=1; 17988 + data _null_; 17989 + set &EM_REPORT_LIB..&RPM_REPORT_MDLCOMP._emoutfit(where=(USE='Y')); 17990 + call symput('RPM_REPORT_MODELNODE',strip(model)); 17991 + run; 17992 + %end; 17993 + %else %if %upcase(%substr(&prednode,1,5)) eq SCORE %then %do; 17994 + %let RPM_REPORT_SCORENODE = &prednode; 17995 + %let prednode = ; 17996 + data _null_ ; 17997 + set &EM_REPORT_LIB..em_dgraph(where=(to="&RPM_REPORT_SCORENODE")); 17998 + call symput('predNode', strip(from)); 17999 + run; 18000 + %let predNode = &predNode; 18002 + %if &prednode ne %then %do; 18003 + %if %upcase(%substr(&prednode,1,7)) eq MDLCOMP %then %do; 18004 + %let RPM_REPORT_MDLCOMP = &prednode; 18005 + %let RPM_REPORT_VALIDSUMMARY=1; 18006 + data _null_; 18007 + set &EM_REPORT_LIB..&RPM_REPORT_MDLCOMP._emoutfit(where=(USE='Y')); 18008 + call symput('RPM_REPORT_MODELNODE',strip(model)); 18009 + run; 18010 + %end; 18011 + %else %do; 18012 + %let em_report_mdlOutfit = &EM_REPORT_LIB..&prednode._emoutfit; 18013 + %if %sysfunc(exist(&em_report_mdlOutfit)) 18014 + %then %do; 18015 + %let RPM_REPORT_MODELNODE = &prednode; 18016 + %let RPM_REPORT_VALIDSUMMARY=1; 18017 + %end; 18018 + %end; 18019 + %end; 18020 + %end; 18021 + %else %do; 18022 + %let em_report_mdlOutfit = &em_lib..&prednode._emoutfit; 18023 + %if %sysfunc(exist(&em_report_mdlOutfit)) 18024 + %then %do; 18025 + %let RPM_REPORT_MODELNODE = &prednode; 18026 + %let RPM_REPORT_VALIDSUMMARY=1; 18027 + %end; 18028 + %end; 18029 + %end; 18031 + %let RPM_REPORT_MODELNODE = &RPM_REPORT_MODELNODE; 18032 + %let RPM_REPORT_SCORENODE = &RPM_REPORT_SCORENODE; 18033 + %let RPM_REPORT_MDLCOMP = &RPM_REPORT_MDLCOMP; 18035 +%mend EM_REPORT_validSummaryPath; 18037 +%macro em_report_summary(runHP=0); 18039 +%global EM_REPORT_SUMMARY_TARGET RPM_REPORT_MDLCOMP RPM_REPORT_MODELNODE; 18040 +%local IDSNode freqvar; 18042 +%if not %sysfunc(exist(emreportpath)) %then %goto skip ; 18044 +/*--- RPM-1. Identify the modeling node -------------------------------------*/ 18046 +%let em_report_modelID = ; 18047 +%let em_report_modeldesc= ; 18049 +%if &RPM_REPORT_MDLCOMP ne %then %do; 18050 + %let em_report_mdloutfit = &em_lib..&RPM_REPORT_MDLCOMP._emoutfit; 18051 + %if %sysfunc(exist(&em_report_mdloutfit)) %then %do; 18052 + data _null_; 18053 + set &em_lib..&RPM_REPORT_MDLCOMP._emoutfit(where=(USE='Y')); 18054 + call symput('em_report_modelID', strip(model)); 18055 + call symput('em_report_modeldesc', strip(modeldescription)); 18056 + run; 18057 + %end; 18058 +%end; 18059 +%else %if &RPM_REPORT_MODELNODE ne %then %do; 18060 + %let em_report_mdloutfit = &em_lib..&RPM_REPORT_MODELNODE._emoutfit; 18061 + %if %sysfunc(exist(&em_report_mdloutfit)) %then %do; 18062 + %let em_report_modelID = &RPM_REPORT_MODELNODE; 18063 + %let em_report_modeldesc = ; 18064 + %end; 18065 +%end; 18067 +/*--- RPM-2. Retrieve necessary information for the model--------------------*/ 18069 +%if &em_report_modelId ne %then %do; 18071 + /* RPM-2.1 save model information */ 18073 + %EM_GETNAME(key=MODELINFO, type=DATA); 18074 + data &EM_USER_MODELINFO; 18075 + format modelID $100. modeldesc $200.; 18076 + modelid = "&em_report_modelID"; 18077 + modeldesc="&em_report_modeldesc"; 18078 + run; 18080 + /* RPM-2.2 retrieve warning file if it exists */ 18082 + %let temp = %nrbquote(%sysfunc(PATHNAME(&em_report_lib))); 18083 + %let path = %nrbquote(%sysfunc(tranwrd(&temp, %str(%"),""))); 18084 + %let file = EMWARN.sas; 18085 + %let warnfile = %nrbquote(&path&em_dsep&em_report_modelId&em_dsep&file); 18087 + %if "&warnfile" ne "" %then %do; 18088 + filename x "&warnfile" encoding='utf-8' NOBOM; 18089 + data _null_; 18090 + length string $1000; 18091 + file PRINT; 18092 + fid = fopen('x'); 18093 + do while (^fread(fid)); 18094 + rc= fget(fid, string, frlen(fid)); 18095 + string = tranwrd(string, "'", "''"); 18096 + if string eq '' then string = ' '; 18097 + put string; 18098 + end; 18099 + fid = fclose(fid); 18100 + put " "; 18101 + run; 18102 + filename x; 18103 + %end; 18105 + /* RPM-2.3 retrieve ID nodeid */ 18107 + data _null_; 18108 + set emreportpath(where=(substr(upcase(strip(nodeid)),1,3) eq "IDS")); 18109 + call symput("idsnode",strip(nodeid)) ; 18110 + run; 18112 + %let idstmeta = &em_lib..&idsnode._emtmetadefault; 18113 + %let idscmeta = &em_lib..&idsnode._emcmetadefault; 18115 + %if %sysfunc(exist(&idstmeta)) %then %do; 18116 + data _null_; 18117 + set &em_lib..&idsnode._emtmetadefault; 18118 + call symput('rpt_rpm_data', strip(MEMNAME)); 18119 + call symput('rpt_rpm_datalib', strip(LIBNAME)); 18120 + call symput('rpt_rpm_nobs', strip(NOBS)); 18121 + call symput('rpt_rpm_ncols', strip(NCOLS)); 18122 + run; 18123 + %end; 18125 + /* RPM-2.4 retrieve name of target to use in presense of multiple targets */ 18126 + /* prefer to use the target given by &EM_REPORT_SUMMARY_TARGET */ 18127 + /* otherwise the last target modelled (by name) will be used */ 18129 + %let mdlTarget = ; 18131 + %if "&EM_REPORT_SUMMARY_TARGET" ne "" %then %do; 18132 + proc sql noprint; 18133 + select count(*) into :tmpn 18134 + from &em_lib..&em_report_modelid._variableset; 18135 + where name eq "&EM_REPORT_SUMMARY_TARGET" and upcase(role) eq "TARGET"; 18136 + quit; 18137 + %if &tmpn eq 1 %then %let mdlTarget = &EM_REPORT_SUMMARY_TARGET; 18138 + %end; 18140 + %if "&mdlTarget" eq "" %then %do; 18141 + data _null_; 18142 + set &em_lib..&em_report_modelid._variableset(where=(role="TARGET" and use="Y")); 18143 + call symput('mdlTarget', strip(name)); 18144 + run; 18145 + %end; 18147 + /* RPM-2.5 retrieve name of decmeta from eminfo of the chosen model */ 18149 + data _null_; 18150 + set &em_lib..&em_report_modelid._eminfo; 18151 + if KEY="DECMETA" %if "&mdlTarget" ne "" %then %do; and target="&mdlTarget" %end; 18152 + then call symput('rpt_rpm_mdldecmeta', strip(data)); 18153 + if KEY="DECDATA" %if "&mdlTarget" ne "" %then %do; and target="&mdlTarget" %end; 18154 + then call symput('rpt_rpm_mdldecdata', strip(data)); 18155 + run; 18157 + /* RPM-2.6 retrieve name of DECISION variable if it exists */ 18158 + /* - use this as target var for categorical target */ 18159 + /* - otherwise use INTO variable as class target var */ 18160 + /* RPM-2.7 retrieve target event level, save TARGETINFO table */ 18161 + /* RPM-2.8 retrieve name of the PREDICTED variable from decmeta */ 18162 + /* - INTERVAL TARGET ONLY */ 18164 + %let catTarget = ; 18166 + data _null_; 18167 + set &rpt_rpm_mdldecmeta; 18168 + if _type_ eq "INTO" then call symput('catTarget', strip(variable)); 18169 + if _type_ eq "MODELDECISION" then call symput('catTarget', strip(variable)); 18171 + if _type_ eq "TARGET" then do; 18172 + call symput('rpt_rpm_eventlvl', strip(event)); 18173 + call symput('rpt_rpm_targetName', strip(variable)); 18174 + call symput('rpt_rpm_targetLevel', strip(level)); 18175 + call symput('rpt_rpm_targetLabel', strip(label)); 18176 + end; 18177 + data _null_; 18178 + set &rpt_rpm_mdldecmeta; 18179 + %if "&rpt_rpm_targetLevel" eq "INTERVAL" %then %do; 18180 + if _type_ eq "PREDICTED" 18181 + then call symput('rpt_rpm_predvar', strip(variable)); 18182 + %end; 18183 + run; 18185 + %EM_GETNAME(key=TARGETINFO, type=DATA); 18186 + data &EM_USER_TARGETINFO; 18187 + set &rpt_rpm_mdldecmeta; 18188 + run; 18190 + /* RPM-2.9 retrieve freq variable name if it exists */ 18192 + %let freqvar=; 18193 + data _null_; 18194 + set &em_lib..&em_report_modelid._variableset(where=(role eq "FREQ")); 18195 + call symput('freqvar', strip(name)); 18196 + run; 18198 + /* RPM-2.10 retrieve listing of all inputs into the model */ 18199 + /* process only when SCORENODE exists */ 18201 + %if &RPM_REPORT_SCORENODE ne %then %do; 18203 + %EM_REGISTER(key=tempvar, type=DATA); 18204 + %EM_REGISTER(key=tempmeta, type=DATA); 18205 + %EM_GETNAME( key=tempvar, type=DATA); 18206 + %EM_GETNAME( key=tempmeta, type=DATA); 18208 + data &EM_USER_tempvar; 18209 + %if %sysfunc(exist(&em_lib..&rpm_report_scorenode._eminputvars)) %then %do; 18210 + set &em_lib..&rpm_report_scorenode._eminputvars(where=(scorevar="Y")); 18211 + %end; 18212 + %else %do; 18213 + set &em_lib..&idsnode._variableset(where=(upcase(role)='INPUT') keep=role name); 18214 + %end; 18215 + run; 18217 + proc sql noprint; 18218 + select count(distinct name) into :n_svars from &EM_USER_tempvar; 18219 + quit; 18221 + proc sort data=&EM_USER_tempvar; by name; 18222 + proc sort data=&idscmeta out=tempmeta; by name; 18224 + data &EM_USER_tempmeta; 18225 + merge &EM_USER_tempvar(in=_a) tempmeta; 18226 + by name; 18227 + if _a; 18228 + run; 18230 + proc delete data=tempmeta; run; 18231 + %end; 18233 + /* RPM-2.11 is HPRPM or not */ 18235 + proc sql noprint; 18236 + select count(*) into :rpt_rpm_isHP from &em_lib..&idsnode._eminfo 18237 + where upcase(key) eq 'HPDMSAMPLE'; 18238 + quit; 18240 + %if &rpt_rpm_isHP ne 0 %then %let rpt_rpm_isHP = 1; 18242 + /* RPM-2.12 determine if vvn variables are present in ids node */ 18244 + %let vvnflag = 0; 18245 + %let cmdsid = %sysfunc(open(&idscmeta)); 18246 + %if &cmdsid %then %do; 18247 + %let newnum = %sysfunc(varnum(&cmdsid, newname)); 18248 + %if &newnum gt 0 %then %let vvnflag = 1; 18249 + %end; 18250 + %if &cmdsid %then %let cmdsid = %sysfunc(close(&cmdsid)); 18252 + %if &vvnflag eq 0 18253 + %then %let name_to_use = name; 18254 + %else %let name_to_use = newname; 18256 +/* end of 2. Retrieve necessary information for the model */ 18257 +%end; 18259 +/*******************************************************************************************/ 18261 +%if &em_report_modelId ne and %sysfunc(exist(&idstmeta)) %then %do; 18263 + %if &EM_PROPERTY_SUMMARIZATION eq Y %then %do; 18265 + %EM_GETNAME(key=DATASUM, type=DATA); 18266 + %EM_GETNAME(key=TARGETSUM, type=DATA); 18267 + %EM_GETNAME(key=VARSUM, type=DATA); 18268 + %let rpt_rpm_eventlvl = %nrbquote(&rpt_rpm_eventlvl); 18270 + /* RPM-3.1 - output data summary ------------------------------------------------------------------*/ 18272 + data &EM_USER_DATASUM; 18273 + length stat $200 value $200; 18274 + label stat = "%sysfunc(sasmsg(sashelp.dmine, rpt_property_vlabel, NOQUOTE))" 18275 + value = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptvalue_vlabel, NOQUOTE))"; 18277 + stat = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptinputdatasource_vlabel, NOQUOTE))"; 18278 + value = "&rpt_rpm_datalib..&rpt_rpm_data"; 18279 + output; 18281 + stat = "%sysfunc(sasmsg(sashelp.dmine, rpt_rpttargetvariable_vlabel, NOQUOTE))"; 18282 + %if "%nrbquote(&rpt_rpm_targetLabel)" ne "" %then %do; 18283 + value = "%nrbquote(&rpt_rpm_targetLabel)"; 18284 + %end; 18285 + %else %do; 18286 + value = "&rpt_rpm_targetName"; 18287 + %end; 18288 + output; 18290 + %if "&rpt_rpm_targetLevel" ne "INTERVAL" %then %do; 18291 + stat = "%sysfunc(sasmsg(sashelp.dmine, rpt_rpteventlevel_vlabel, NOQUOTE))"; 18292 + value = "&rpt_rpm_eventlvl"; 18293 + output; 18294 + %end; 18296 + stat = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptobservations_vlabel, NOQUOTE))"; 18297 + value = "&rpt_rpm_nobs"; 18298 + output; 18300 + stat = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptorigvars_vlabel, NOQUOTE))"; 18301 + value = "&rpt_rpm_ncols"; 18302 + output; 18304 + %if &RPM_REPORT_SCORENODE ne %then %do; 18305 + %if &n_svars ne %then %do; 18306 + stat="%sysfunc(sasmsg(sashelp.dmine, rpt_rptselectedvars_vlabel, NOQUOTE))"; 18307 + value="&n_svars"; 18308 + output; 18309 + %end; 18310 + %end; 18311 + run; 18313 + ods &EM_REPORT_FORMAT text=" "; 18314 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptmodelsummarization_title, NOQUOTE))"; 18315 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptdata_title, NOQUOTE))"; 18316 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptmodelsummarization_title, NOQUOTE)) %sysfunc(sasmsg(sashelp.dmine, rpt_rptdata_title, NOQUOTE))"; 18318 + proc print data=&EM_USER_DATASUM noobs label style=[outputwidth=50%]; run; 18320 + /* RPM-3.2 - output target summary -----------------------------------------------------------------*/ 18322 + ods &EM_REPORT_FORMAT text=" "; 18323 + %if "%nrbquote(&rpt_rpm_targetLabel)" ne "" %then %do; 18324 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rpttarget_title, NOQUOTE, %nrstr(&rpt_rpm_targetLabel)))"; 18325 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rpttarget_title, NOQUOTE, %nrstr(&rpt_rpm_targetLabel)))"; 18326 + %end; 18327 + %else %do; 18328 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rpttarget_title, NOQUOTE, &rpt_rpm_targetName))"; 18329 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rpttarget_title, NOQUOTE, &rpt_rpm_targetName))"; 18330 + %end; 18332 + %if "&rpt_rpm_targetLevel" ne "INTERVAL" 18333 + %then %do; 18334 + /* target summary for for non-interval target */ 18336 + %let useD = N; 18337 + data _null_; 18338 + set &rpt_rpm_mdldecmeta(where=(_type_ in ('MATRIX'))) end=eof; 18339 + if eof then call symput('useD', USE); 18340 + run; 18342 + %let useP = N; 18343 + data _null_; 18344 + set &rpt_rpm_mdldecmeta(where=(_type_ in ('DECPRIOR'))) end=eof; 18345 + if eof then call symput('useP', USE); 18346 + run; 18348 + data &EM_USER_TARGETSUM; 18349 + set &rpt_rpm_mdldecdata; 18350 + label 18351 + &rpt_rpm_targetName = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptvalue_vlabel, NOQUOTE))" 18352 + count = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptcount_vlabel, NOQUOTE))" 18353 + trainprior = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptdatapercentage_vlabel, NOQUOTE))" 18354 + decprior = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptadjustedperc_vlabel, NOQUOTE))"; 18355 + ; 18356 + %if &useD eq Y and &useP eq Y %then %do; drop dataprior; %end; 18357 + %if &useD eq Y and &useP eq N %then %do; drop decprior dataprior; %end; 18358 + %if &useD eq N and &useP eq Y %then %do; keep &rpt_rpm_targetName count trainprior decprior; %end; 18359 + %if &useD eq N and &useP eq N %then %do; keep &rpt_rpm_targetName count trainprior; %end; 18360 + run; 18362 + proc print data=&EM_USER_TARGETSUM noobs label style=[outputwidth=50%]; run; 18363 + %end; 18364 + %else %do; 18365 + /* target summary for interval target */ 18367 + data _null_; 18368 + set &em_lib..&idsnode._cmeta_data(where=(ROLE='TARGET')); 18369 + call symput('rpt_rpm_ids_target', strip(name)); 18370 + run; 18372 + %if &rpt_rpm_isHP eq 1 %then %do; 18373 + ods &EM_REPORT_FORMAT exclude all; 18374 + ods listing; 18375 + proc hpdmdb data=&em_lib..&idsnode._data varout=temp1; 18376 + var &rpt_rpm_ids_target; 18377 + proc transpose data=temp1 18378 + out=&EM_USER_TARGETSUM(rename=(col1=&rpt_rpm_ids_target _name_=_stat_)); 18379 + by name notsorted; 18380 + var n min max mean std; 18381 + run; 18382 + ods listing close; 18383 + ods &EM_REPORT_FORMAT select all; 18384 + proc delete data=temp1; run; 18385 + %end; 18386 + %else %do; 18387 + proc means data=&em_lib..&idsnode._data noprint; 18388 + var &rpt_rpm_ids_target; 18389 + output out=&EM_USER_TARGETSUM; 18390 + run; 18392 + data &EM_USER_TARGETSUM; 18393 + format _stat_ $50.; 18394 + set &EM_USER_TARGETSUM; 18395 + if strip(upcase(_stat_)) eq "MIN" then _stat_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_minimum_vlabel, NOQUOTE))"; 18396 + if strip(upcase(_stat_)) eq "MAX" then _stat_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_maximum_vlabel, NOQUOTE))"; 18397 + if strip(upcase(_stat_)) eq "N" then _stat_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_numObs_vlabel, NOQUOTE))"; 18398 + if strip(upcase(_stat_)) eq "MEAN" then _stat_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_mean_vlabel, NOQUOTE))"; 18399 + if strip(upcase(_stat_)) eq "STD" then _stat_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_std_vlabel, NOQUOTE))"; 18400 + run; 18401 + %end; 18403 + proc print data=&EM_USER_TARGETSUM noobs label style=[outputwidth=50%]; 18404 + var _stat_ &rpt_rpm_ids_target; 18405 + label _stat_ = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptstatistic_vlabel, NOQUOTE))" 18406 + &rpt_rpm_ids_target = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptvalue_vlabel, NOQUOTE))"; 18407 + run; 18408 + %end; 18410 + /* RPM-3.3 - output variable summary ---------------------------------------------------------------*/ 18412 + %if &RPM_REPORT_SCORENODE ne %then %do; 18414 + proc sql noprint; 18415 + create table tempselected as 18416 + select a.*, b.name as selected 18417 + from &em_lib..&idsnode._variableset as a left join &EM_USER_tempmeta as b 18418 + on a.name eq b.name 18419 + ; 18420 + create table &EM_USER_VARSUM as 18421 + select role,level, count(distinct name) as count, sum(selected ne ' ') as sel_count 18422 + from tempselected 18423 + group by role, level 18424 + order by role, level 18425 + ; 18426 + quit; 18428 + ods &EM_REPORT_FORMAT text=" "; 18429 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptvarsummary_title, NOQUOTE))"; 18430 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptvarsummary_title, NOQUOTE))"; 18432 + data &EM_USER_VARSUM; 18433 + format role $50. level $50.; 18434 + set &EM_USER_VARSUM; 18436 + role = upcase(strip(role)); 18437 + level = upcase(strip(level)); 18439 + if role eq 'ASSESS' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_assess_vlabel, NOQUOTE))"; 18440 + else if role eq 'COST' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_cost_vlabel, NOQUOTE))"; 18441 + else if role eq 'CENSOR' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_censor_vlabel, NOQUOTE))"; 18442 + else if role eq 'CROSSID' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_crossid_vlabel, NOQUOTE))"; 18443 + else if role eq 'FREQ' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_freq_vlabel, NOQUOTE))"; 18444 + else if role eq 'GROUP' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_group_vlabel, NOQUOTE))"; 18445 + else if role eq 'DECISION' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_decision_vlabel, NOQUOTE))"; 18446 + else if role eq 'CLASSIFICATION' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_classification_vlabel, NOQUOTE))"; 18447 + else if role eq 'KEY' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_key_vlabel, NOQUOTE))"; 18448 + else if role eq 'MISSING' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_missing_vlabel, NOQUOTE))"; 18449 + else if role eq 'PREDICT' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_predict_vlabel, NOQUOTE))"; 18450 + else if role eq 'REFERRER' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_referrer_vlabel, NOQUOTE))"; 18451 + else if role eq 'REJECTED' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_rejected_vlabel, NOQUOTE))"; 18452 + else if role eq 'SEGMENT' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_segment_vlabel, NOQUOTE))"; 18453 + else if role eq 'SEQUENCE' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_sequence_vlabel, NOQUOTE))"; 18454 + else if role eq 'TEXT' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_text_vlabel, NOQUOTE))"; 18455 + else if role eq 'TIMEID' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_timeid_vlabel, NOQUOTE))"; 18456 + else if role eq 'TRIAL' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_trial_vlabel, NOQUOTE))"; 18457 + else if role eq 'ID' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_id_vlabel, NOQUOTE))"; 18458 + else if role eq 'INPUT' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_input_vlabel, NOQUOTE))"; 18459 + else if role eq 'TARGET' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_target_vlabel, NOQUOTE))"; 18460 + else if role eq 'TREATMENT' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_treatment_vlabel, NOQUOTE))"; 18461 + else if role eq 'RESIDUAL ' then role= "%sysfunc(sasmsg(sashelp.dmine, rpt_residual_vlabel, NOQUOTE))"; 18462 + else if role eq 'LABEL' then role= "%sysfunc(sasmsg(sashelp.dmine, meta_label_vlabel, NOQUOTE))"; 18464 + if level eq 'INTERVAL' then level = "%sysfunc(sasmsg(sashelp.dmine, rpt_rpm_interval_vlabel , NOQUOTE))"; 18465 + else if level eq 'NOMINAL' then level = "%sysfunc(sasmsg(sashelp.dmine, rpt_rpm_nominal_vlabel , NOQUOTE))"; 18466 + else if level eq 'ORDINAL' then level = "%sysfunc(sasmsg(sashelp.dmine, rpt_rpm_ordinal_vlabel , NOQUOTE))"; 18467 + else if level eq 'BINARY' then level = "%sysfunc(sasmsg(sashelp.dmine, rpt_rpm_binary_vlabel , NOQUOTE))"; 18468 + else if level eq 'UNARY' then level = "%sysfunc(sasmsg(sashelp.dmine, rpt_rpm_unary_vlabel , NOQUOTE))"; 18470 + role = strip(role); 18471 + level = strip(level); 18472 + run; 18474 + proc print data=&EM_USER_VARSUM label noobs style=[outputwidth=50%]; 18475 + var role level count sel_count; 18476 + label role = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptrole_vlabel, NOQUOTE))" 18477 + level = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptlevel_vlabel, NOQUOTE))" 18478 + count = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptorigcount_vlabel, NOQUOTE))" 18479 + sel_count = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptselcount_vlabel, NOQUOTE))"; 18480 + run; 18482 + proc delete data=tempselected; run; 18483 + %end; 18484 + %end; /* end of --&EM_PROPERTY_SUMMARIZATION eq Y --*/ 18485 +/* three output in this section: datasum, targetsum, varsum --*/ 18486 +%end; /* end of &em_report_modelId ne - end of block 3.1,3.2,3.3 --*/ 18489 +/***** RPM-4. varRank and Scorecard ************************************************************************/ 18491 +%if &em_report_modelId ne and %sysfunc(exist(&idstmeta)) and &RPM_REPORT_SCORENODE ne %then %do; 18493 + %EM_GETNAME(key=VARRANK, type=DATA); 18494 + %EM_GETNAME(key=SCORECARD, type=DATA); 18496 + %if "&rpt_rpm_targetLevel" ne "INTERVAL" 18497 + %then %let scorecard_target = &catTarget; 18498 + %else %let scorecard_target = &rpt_rpm_predvar; 18500 + %if &runHP eq 0 %then %do; 18502 + %global EM_SUMMARY_REPORT_MAXOBS EM_SUMMARY_REPORT_SAMPLEMETHOD ; 18504 + %if &EM_SUMMARY_REPORT_MAXOBS ne %then %do; 18505 + %let maxobs = &EM_SUMMARY_REPORT_MAXOBS; 18506 + %end; 18507 + %else %do; 18508 + %exploreObs(data=&em_lib..&em_report_modelid._train); 18509 + %let maxobs = &_EXPLOREOBS_MAX; 18510 + %end; 18512 + %if "&EM_SUMMARY_REPORT_SAMPLEMETHOD" ne "" 18513 + %then %let sampleMethod = &EM_SUMMARY_REPORT_SAMPLEMETHOD; 18514 + %else %let sampleMethod = RANDOM; 18516 + %exploreSample( 18517 + data = &em_lib..&em_report_modelid._train, 18518 + seed = 12345, 18519 + output = &em_report_modelid._trainsample, 18520 + method = &sampleMethod, 18521 + size = &maxobs, 18522 + sizetype = obs, 18523 + metaData = &em_lib..&em_report_modelid._cmeta_train 18524 + ); 18526 + %em_reporter_scorecard( 18527 + indata = %str(&em_report_modelid._trainsample), 18528 + indata2 = %str(&em_lib..&em_report_modelid._train), 18529 + inVariableSet = &EM_USER_tempmeta, 18530 + name = &name_to_use, 18531 + libname = work, 18532 + crosstab = &EM_PROPERTY_CROSSTABS, 18533 + targetVar = &scorecard_target, 18534 + targetVar2 = &rpt_rpm_targetName, 18535 + targetLevel = &rpt_rpm_targetLevel, 18536 + freqVar = &freqVar, 18537 + outVarRank = &EM_USER_VarRank, 18538 + outScoreCard = &EM_USER_ScoreCard 18539 + ); 18541 + proc sort data=&em_lib..&idsnode._variableset 18542 + out=templabel(keep=&name_to_use label %if &vvnflag eq 1 %then %do; name %end;); 18543 + by &name_to_use; 18544 + run; 18546 + %if %sysfunc(exist(&EM_USER_ScoreCard)) ne 0 %then %do; 18548 + proc sort data=&EM_USER_ScoreCard; 18549 + by displayVar; 18550 + data &EM_USER_ScoreCard; 18551 + merge &EM_USER_ScoreCard(in=_a) templabel(rename=(&name_to_use=displayVar label=emrpmtmp_lbael)); 18552 + by displayVar; 18553 + if _a; 18554 + %if &vvnflag eq 1 %then %do; 18555 + if ^missing(name) then displayvar=name; 18556 + %end; 18557 + if ^missing(emrpmtmp_lbael) then displayvar=emrpmtmp_lbael; 18558 + drop emrpmtmp_lbael name; 18559 + run; 18561 + %end; 18563 + %if %sysfunc(exist(&EM_USER_VarRank)) ne 0 %then %do; 18565 + proc sort data=&EM_USER_VarRank; 18566 + by variable; 18567 + data &EM_USER_VarRank; 18568 + merge &EM_USER_VarRank(in=_a) templabel(rename=(&name_to_use=variable)); 18569 + by variable; 18570 + if _a; 18571 + if missing(label) then do; 18572 + label = variable; 18573 + %if &vvnflag eq 1 %then %do; 18574 + if ^missing(name) then label=name; 18575 + %end; 18576 + end; 18577 + proc sort data=&EM_USER_VarRank; 18578 + by descending rank; 18579 + run; 18581 + %end; 18583 + %if %sysfunc(exist(&EM_USER_VarRank)) ne 0 and &EM_PROPERTY_VARRANKING eq Y %then %do; 18584 + /* generate gtable like listing of variable importance */ 18585 + ods path(prepend) work.templat(update); 18586 + proc template; 18587 + define statgraph Rules / store=work.templat ; 18588 + begingraph / designheight=470px; 18589 + %if "&EM_REPORT_TITLE" ne "" 18590 + %then %do; entrytitle "&EM_REPORT_TITLE"; %end; 18591 + %else %do; entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; %end; 18592 + entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_rptvarranking_title, NOQUOTE))"; 18593 + layout lattice / columns=2 rowdatarange=union columnweights=(0.9 0.1) columngutter=0; 18594 + rowaxes; rowaxis; endrowaxes; 18595 + layout overlay / xaxisopts=(display=(line)); 18596 + barchart x=label y=worth / orient=horizontal; 18597 + endlayout; 18598 + endlayout; 18599 + endgraph; 18600 + end; 18601 + run; 18602 + proc sgrender data=&EM_USER_VARRANK template=Rules; run; 18603 + %end; 18604 + %end; 18605 + %else %do; 18607 + %if &rpt_rpm_isHP eq 1 18608 + %then %let scorecard_lib = &rpt_rpm_datalib; 18609 + %else %let scorecard_lib = work; 18611 + ods &EM_REPORT_FORMAT exclude all; 18612 + ods listing; 18613 + %hpdm_scorecard( 18614 + indata = %str(&em_lib..&em_report_modelID._train), 18615 + inVariableSet = &EM_USER_tempmeta, 18616 + name = &name_to_use, 18617 + libname = &scorecard_lib, 18618 + crosstab = &EM_PROPERTY_CROSSTABS, 18619 + targetVar = &scorecard_target, 18620 + targetVar2 = &rpt_rpm_targetName, 18621 + targetLevel = &rpt_rpm_targetLevel, 18622 + freqVar = &freqVar, 18623 + outVarRank = &EM_USER_VarRank, 18624 + outScoreCard = &EM_USER_ScoreCard 18625 + ); 18626 + ods listing close; 18627 + ods &EM_REPORT_FORMAT select all; 18629 + /* 3.4 - Variable Ranking from PROC HPREDUCE */ 18631 + %if &EM_PROPERTY_VARRANKING eq Y %then %do; 18632 + ods &EM_REPORT_FORMAT text=" "; 18633 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptvarranking_title, NOQUOTE))"; 18634 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptvarranking_title, NOQUOTE))"; 18635 + proc print data=&EM_USER_VARRANK noobs; 18636 + var number variable; 18637 + run; 18638 + %end; 18639 + %end; 18640 + %end; 18643 +/* RPM-5. Cumulative Lift chart *********************************************************************/ 18645 +%if &EM_PROPERTY_LIFTCHART eq Y %then %do; 18647 + %let em_rank = &em_lib..%sysfunc(trim(&em_report_modelid))_emrank; 18649 + %if %sysfunc(exist(&em_rank)) %then %do; 18651 + %EM_GETNAME(key=LIFT, type=DATA); 18652 + data &EM_USER_LIFT; 18653 + set &em_rank end=eof; 18654 + if eof then call symput("_tarexists_", strip(target)); 18656 + if upcase(strip(datarole)) eq 'TRAIN' then datarole = "%sysfunc(sasmsg(sashelp.dmine, rpt_roletrain_value, NOQUOTE))"; 18657 + else if upcase(strip(datarole)) eq 'RAW' then datarole = "%sysfunc(sasmsg(sashelp.dmine, rpt_roleraw_value, NOQUOTE))"; 18658 + else if upcase(strip(datarole)) eq 'VALIDATE' then datarole = "%sysfunc(sasmsg(sashelp.dmine, rpt_rolevalidate_value, NOQUOTE))"; 18659 + datarole = strip(datarole); 18660 + run; 18662 + %let em_class=&em_lib..%sysfunc(trim(&em_report_modelid))_emclassification; 18664 + %if (%sysfunc(exist(&em_class)) and "&rpt_rpm_targetLevel" ne "INTERVAL" ) 18665 + %then %do; 18666 + %let this_title = rpt_rptcumliftchart_title; 18667 + %let this_plotY = liftc; 18668 + %end; 18669 + %else %do; 18670 + %let this_title = rpt_rptmeanpredresp_title; 18671 + %let this_plotY = _MEANP_; 18672 + %end; 18674 + ods path(prepend) work.templat(update); 18675 + proc template; 18676 + define statgraph liftplot / store=work.templat; 18677 + begingraph / designheight=470px; 18678 + %if "&EM_REPORT_TITLE" ne "" 18679 + %then %do; entrytitle "&EM_REPORT_TITLE"; %end; 18680 + %else %do; entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; %end; 18681 + entrytitle "%sysfunc(sasmsg(sashelp.dmine, &this_title, NOQUOTE))"; 18682 + layout overlay; 18683 + seriesplot x=decile y=&this_plotY 18684 + / group =datarole lineattrs=(pattern=solid) name='lift'; 18685 + discretelegend 'lift' ; 18686 + endlayout; 18687 + endgraph; 18688 + end; 18689 + run; 18691 + proc sgrender data=&EM_USER_LIFT 18692 + %if "&_tarexists_" ne "." %then %do; (where=(target="&rpt_rpm_targetName")) %end; 18693 + template=liftplot; 18694 + run; 18695 + %end; 18696 +%end; 18698 +/* RPM-6. Cumulative captured response chart *********************************************************/ 18700 +%if &EM_PROPERTY_BASICOUTPUT eq Y %then %do; 18702 + %EM_GETNAME(key=CAPRESPONSE, type=DATA); 18704 + %let em_report_rank = &em_lib..%sysfunc(trim(&em_report_modelid))_emrank; 18706 + %if %sysfunc(exist(&em_report_rank)) %then %do; 18708 + %let em_report_class = &em_lib..%sysfunc(trim(&em_report_modelid))_emclassification; 18710 + %if (%sysfunc(exist(&em_report_class)) and "&rpt_rpm_targetLevel" ne "INTERVAL" ) %then %do; 18712 + /* generate % values and create categorical x values for plotting purposes */ 18713 + data &EM_USER_CAPRESPONSE; 18714 + set &em_report_rank end=eof; 18715 + length baseCat bestCat capCat decCat liftCat liftCCat $5; 18716 + format basecapcp bestcapcp capcp decilep PERCENT6.0; 18717 + basecapcp = basecapc / 100; baseCat= put(basecapcp, PERCENT6.0 -L); 18718 + bestcapcp = bestcapc / 100; bestCat= put(bestcapcp, PERCENT6.0 -L); 18719 + capcp = capc / 100; capCat = put(capcp, PERCENT6.0 -L); 18720 + decilep = decile / 100; decCat = put(decilep, PERCENT6.0 -L); 18721 + liftCat = lift; 18722 + liftCCat= liftC; 18723 + if eof then call symput("_tarexists_", strip(target)); 18724 + run; 18726 + /* create template for Captured Response Plot */ 18728 + ods path(prepend) work.templat(update); 18729 + proc template; 18730 + define statgraph reg_emrank / store=work.templat; 18731 + begingraph / designheight=470px; 18732 + %if "&EM_REPORT_TITLE" ne "" 18733 + %then %do; entrytitle "&EM_REPORT_TITLE"; %end; 18734 + %else %do; entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; %end; 18735 + entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_rptmodelgains_title, NOQUOTE))"; 18736 + layout overlay / cycleattrs=true xaxisopts=(display=(LINE)) yaxisopts=(label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptcumcaptresponse_vlabel, NOQUOTE))"); 18737 + seriesplot x=deccat y=basecapcp / lineattrs=(pattern=solid) name='base' legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_rptbase_vlabel, NOQUOTE))"; 18738 + seriesplot x=deccat y=bestcapcp / lineattrs=(pattern=solid) name='best' legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_rptbest_vlabel, NOQUOTE))"; 18739 + seriesplot x=deccat y=capcp / lineattrs=(pattern=solid) name='model' legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_rptmodel_vlabel, NOQUOTE))"; 18740 + innermargin / align=bottom; 18741 + blockplot x=deccat block=liftCcat / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptcumlift_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18742 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata5 altfillattrs=graphdata5; 18743 + blockplot x=deccat block=liftcat / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptlift_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18744 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata4 altfillattrs=graphdata4; 18745 + blockplot x=deccat block=capcat / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptmodel_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18746 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata3 altfillattrs=graphdata3; 18747 + blockplot x=deccat block=bestcat / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptbest_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18748 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata2 altfillattrs=graphdata2; 18749 + blockplot x=deccat block=deccat / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptdecile_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18750 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdatadefault altfillattrs=graphdatadefault; 18751 + endinnermargin; 18752 + * discretelegend "base" "best" "model" / across=1 location=inside halign=right valign=bottom; 18753 + endlayout; 18754 + endgraph; 18755 + end; 18756 + run; 18757 + %end; 18758 + %else %do; 18760 + /* generate % values and create categorical x values for plotting purposes */ 18761 + data &EM_USER_CAPRESPONSE; 18762 + set &em_report_rank end=eof; 18763 + length decCat $5; 18764 + format decilep PERCENT6.0; 18765 + decilep = decile / 100; 18766 + decCat = put(decilep, PERCENT6.0 -L); 18767 + if eof then call symput("_tarexists_", strip(target)); 18768 + run; 18770 + /* create template for Captured Response Plot */ 18771 + ods path(prepend) work.templat(update); 18772 + proc template; 18773 + define statgraph reg_emrank / store=work.templat; 18774 + begingraph / designheight=470px ; 18775 + %if "&EM_REPORT_TITLE" ne "" 18776 + %then %do; entrytitle "&EM_REPORT_TITLE"; %end; 18777 + %else %do; entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; %end; 18778 + entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_rptmodelgainspred_title, NOQUOTE))"; 18779 + layout overlay / cycleattrs=true xaxisopts=(display=(LINE)) yaxisopts=(label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptpredresp_vlabel, NOQUOTE))"); 18780 + seriesplot x=deccat y=_meanp_ / lineattrs=(pattern=solid) name='mean' legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_mean_vlabel, NOQUOTE))"; 18781 + seriesplot x=deccat y=_minp_ / lineattrs=(pattern=solid) name='min' legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_minimum_vlabel, NOQUOTE))"; 18782 + seriesplot x=deccat y=_maxp_ / lineattrs=(pattern=solid) name='max' legendlabel="%sysfunc(sasmsg(sashelp.dmine, rpt_maximum_vlabel, NOQUOTE))"; 18783 + innermargin / align=bottom; 18784 + blockplot x=deccat block=_targetmean_ / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rpttargetmean_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18785 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata5 altfillattrs=graphdata5; 18786 + blockplot x=deccat block=_targetmin_ / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rpttargetmin_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18787 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata4 altfillattrs=graphdata4; 18788 + blockplot x=deccat block=_targetmax_ / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rpttargetmax_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18789 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata3 altfillattrs=graphdata3; 18790 + blockplot x=deccat block=_meanp_ / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptpredmean_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18791 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata5 altfillattrs=graphdata5; 18792 + blockplot x=deccat block=_minp_ / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptpredmin_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18793 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata4 altfillattrs=graphdata4; 18794 + blockplot x=deccat block=_maxp_ / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptpredmax_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18795 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdata3 altfillattrs=graphdata3; 18796 + blockplot x=deccat block=deccat / label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptdecile_vlabel, NOQUOTE))" valuehalign=center filltype=alternate 18797 + repeatedvalues=true valueattrs=(size=7) VALUEFITPOLICY=SHRINK fillattrs=graphdatadefault altfillattrs=graphdatadefault; 18798 + endinnermargin; 18799 + * discretelegend "mean" "min" "max" / across=1 location=inside halign=left valign=bottom; 18800 + endlayout; 18801 + endgraph; 18802 + end; 18803 + run; 18804 + %end; 18806 + /* render plot */ 18808 + %let validflag=0; 18809 + data tempvalid; 18810 + set &EM_USER_CAPRESPONSE(where=(datarole="VALIDATE")); 18811 + run; 18813 + %let dsid = %sysfunc(open(work.tempvalid)); 18814 + %if &dsid %then %do; 18815 + %let validobs = %sysfunc(attrn(&dsid, NOBS)); 18816 + %if &validobs gt 0 %then %let validflag = 1; 18817 + %end; 18818 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 18820 + proc sgrender data=&EM_USER_CAPRESPONSE 18821 + %if "&_tarexists_" ne "." %then %do; (where=(target="&rpt_rpm_targetName"))%end; 18822 + template=reg_emrank; 18823 + %if &validflag eq 1 18824 + %then %do; where datarole="VALIDATE"; %end; 18825 + %else %do; where datarole="TRAIN"; %end; 18826 + run; 18827 + %end; 18828 +%end; 18831 +/* RPM-7. ROC CHART ******************************************************************************************/ 18833 +%if ((&RPM_REPORT_MDLCOMP ne ) or (&em_report_modelid ne )) and (&EM_PROPERTY_BASICOUTPUT eq Y) %then %do; 18835 + %let em_report_roc = &em_lib..&RPM_REPORT_MDLCOMP._emroc; 18836 + %let em_report_hpassess = &em_lib..%sysfunc(trim(&em_report_modelid))_hpassess; 18837 + %let em_report_hpstats = &em_lib..%sysfunc(trim(&em_report_modelid))_hpreportstats; 18839 + %EM_GETNAME(key=ROC, type=DATA); 18840 + %let plot_KS = 0; 18841 + %let plot_ROC = 0; 18842 + %let train_X = 0; %let train_Y = 0; %let train_KS = 0; 18843 + %let valid_X = 0; %let valid_Y = 0; %let valid_KS = 0; 18845 + %if %sysfunc(exist(&em_report_roc)) %then %do; 18847 + proc sql noprint; 18848 + select count(*) into :validroc from &em_report_roc where datarole eq "VALIDATE"; 18849 + quit; 18851 + /* make the ROC table */ 18852 + data &EM_USER_ROC; 18853 + length group $32 diff 8; 18854 + label group="&em_report_modeldesc %sysfunc(sasmsg(sashelp.dmine, rpt_rptmodel_vlabel, NOQUOTE))"; 18855 + set &em_report_roc; 18856 + if strip(model)='_Baseline_' 18857 + then group='Baseline'; 18858 + else group=Datarole; 18859 + where (strip(model) ='_Baseline_' and DataRole='TRAIN') or (strip(model)= "&em_report_modelid" and DataRole in('TRAIN','VALIDATE')); 18860 + diff = sensitivity-oneminusspecificity; 18861 + run; 18863 + /* get KS statistics */ 18865 + proc sql noprint; 18866 + create table ks_stat as 18867 + select distinct datarole, max(diff) as ks from &EM_USER_ROC group by datarole; 18868 + select round(ks, 0.00001) into :train_ks 18869 + from ks_stat where datarole eq 'TRAIN'; 18870 + select round(ks, 0.00001) into :valid_ks 18871 + from ks_stat where datarole eq 'VALIDATE'; 18872 + select oneMinusSpecificity, sensitivity into :train_x, :train_y 18873 + from &EM_USER_ROC where datarole eq 'TRAIN' and round(diff, 0.00001) eq &train_ks; 18874 + select oneMinusSpecificity, sensitivity into :valid_x, :valid_y 18875 + from &EM_USER_ROC where datarole eq 'VALIDATE' and round(diff, 0.00001) eq &valid_ks; 18876 + quit; 18878 + %let plot_KS = 1; 18879 + %let plot_ROC = 1; 18880 + %end; 18881 + %else %if %sysfunc(exist(&em_report_hpassess)) and "&rpt_rpm_targetLevel" ne "INTERVAL" %then %do; 18883 + /* make the ROC table */ 18885 + proc sql noprint; 18886 + select count(*) into :validroc from &em_report_hpassess where datarole eq "VALIDATE"; 18887 + quit; 18889 + data &EM_USER_ROC; 18890 + length group $32; 18891 + group='Baseline'; 18892 + sensitivity = 0; oneminusspecificity = 0; output; 18893 + sensitivity = 1; oneminusspecificity = 1; output; 18894 + run; 18896 + data &EM_USER_ROC; 18897 + length group $32; 18898 + set &em_report_hpassess(in=in1 rename=(one_minus_specificity=oneminusspecificity)) &EM_USER_ROC; 18899 + if in1 then group=datarole; 18900 + label group="&em_report_modeldesc %sysfunc(sasmsg(sashelp.dmine, rpt_rptmodel_vlabel, NOQUOTE))"; 18901 + run; 18903 + /* get KS statistics */ 18905 + %if %sysfunc(exist(&em_report_hpstats)) %then %do; 18907 + data _null_; 18908 + set &em_report_hpstats; 18909 + if upcase(stat) eq 'KSREF' then call symput('train_X', put(train,best24.)); 18910 + if upcase(stat) eq 'KSR' then call symput('train_KS',round(train,0.00001)); 18911 + %if &validroc ge 1 %then %do; 18912 + if upcase(stat) eq 'KSREF' then call symput('valid_X', put(validate,best24.)); 18913 + if upcase(stat) eq 'KSR' then call symput('valid_KS',round(validate,0.00001)); 18914 + %end; 18915 + run; 18917 + data _null_; 18918 + tmp=&train_X+&train_KS/100; call symput('train_Y',put(tmp,best24.)); 18919 + tmp=&valid_X+&valid_KS/100; call symput('valid_Y',put(tmp,best24.)); 18920 + run; 18922 + %if &train_Y gt 0 %then %let plot_KS = 1; 18923 + %let plot_ROC = 1; 18924 + %end; 18925 + %end; 18927 + %if &plot_ROC eq 1 %then %do; 18929 + /* add coordinates for ref lines */ 18930 + data refline; 18931 + length oneminusspecificity sensitivity x y 8 datarole $8 group $32 text $60; 18932 + %if &train_Y gt 0 %then %do; 18933 + oneminusspecificity=&TRAIN_X; sensitivity=&TRAIN_Y; datarole='TRAIN'; group='TRAIN'; 18934 + text=""; x=.; y=.; output; 18935 + oneminusspecificity=&TRAIN_X; sensitivity=&TRAIN_X; datarole='TRAIN'; group='TRAIN'; 18936 + text=catx(' = ',"%sysfunc(sasmsg(sashelp.dmine, rpt_trainks_vlabel, NOQUOTE))","&train_KS"); x=&TRAIN_X; y=&TRAIN_X - 0.05; output; 18937 + oneminusspecificity=&TRAIN_X; sensitivity=&TRAIN_Y; datarole='TRAIN'; group='TRAIN'; 18938 + text=""; x=.; y=.; output; 18939 + %end; 18940 + %if &validroc ge 1 and &valid_Y gt 0 %then %do; 18941 + oneminusspecificity=&VALID_X; sensitivity=&VALID_Y; datarole='VALIDATE'; group='VALIDATE'; 18942 + text=""; x=.; y=.; output; 18943 + oneminusspecificity=&VALID_X; sensitivity=&VALID_X; datarole='VALIDATE'; group='VALIDATE'; 18944 + text=catx(' = ',"%sysfunc(sasmsg(sashelp.dmine, rpt_validks_vlabel, NOQUOTE))","&valid_KS"); x=&VALID_X; y=&VALID_X - 0.05; output; 18945 + oneminusspecificity=&VALID_X; sensitivity=&VALID_Y; datarole='VALIDATE'; group='VALIDATE'; 18946 + text=""; x=.; y=.; output; 18947 + %end; 18948 + data &EM_USER_ROC; 18949 + set &EM_USER_ROC refline; 18950 + if group eq 'TRAIN' then group = "%sysfunc(sasmsg(sashelp.dmine, rpt_train_vlabel, NOQUOTE))"; 18951 + if group eq 'VALIDATE' then group = "%sysfunc(sasmsg(sashelp.dmine, rpt_validate_vlabel, NOQUOTE))"; 18952 + if group eq 'Baseline' then group = "%sysfunc(sasmsg(sashelp.dmine, rpt_baselineroc_value, NOQUOTE))"; 18953 + run; 18955 + /* plot ROC chart */ 18956 + ods path(prepend) work.templat(update); 18957 + proc template; 18958 + define statgraph rocplot / store=work.templat; 18959 + begingraph / designheight=470px; 18960 + %if "&EM_REPORT_TITLE" ne "" 18961 + %then %do; entrytitle "&EM_REPORT_TITLE"; %end; 18962 + %else %do; entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_reporttitleone_title, NOQUOTE))"; %end; 18963 + entrytitle "%sysfunc(sasmsg(sashelp.dmine, rpt_rptroc_title, NOQUOTE))"; 18964 + layout overlay; 18965 + seriesplot x=oneminusspecificity y=sensitivity / group =group lineattrs=(pattern=solid) name='series'; 18966 + %if &plot_ks eq 1 %then %do; 18967 + scatterplot x=x y=y / group=group datalabel=text datalabelattrs=(weight=bold) markerattrs=(size=0px); 18968 + %end; 18969 + discretelegend 'series' / title="&em_report_modeldesc %sysfunc(sasmsg(sashelp.dmine, rpt_rptmodel_vlabel, NOQUOTE))"; 18970 + endlayout; 18971 + endgraph; 18972 + end; 18973 + run; 18975 + proc sort data=&EM_USER_ROC; by group oneminusspecificity; run; 18976 + proc sgrender data=&EM_USER_ROC template=rocplot; run; 18977 + title1; title2; 18978 + %end; 18979 +%end; 18981 +/* RPM-8. Scorecard *****************************************************************************************/ 18983 +%if &EM_PROPERTY_BASICOUTPUT eq Y %then %do; 18985 + %if %sysfunc(exist(&EM_USER_ScoreCard)) ne 0 and &runHP eq 0 %then %do; 18987 + %let ColPercNum = 0; 18988 + %let sdsid = %sysfunc(open(&EM_USER_SCORECARD)); 18989 + %let colPercnum = %sysfunc(varnum(&sdsid, colPercent)); 18990 + %if &sdsid %then %let sdsid = %sysfunc(close(&sdsid)); 18992 + %let tmpstr1 = %sysfunc(sasmsg(sashelp.dmine, rpt_rptscorecard_scpoints, NOQUOTE)); 18993 + %let tmpstr2 = %sysfunc(sasmsg(sashelp.dmine, rpt_rptscorecard_overall, NOQUOTE)); 18994 + %let tmpstr3 = %sysfunc(sasmsg(sashelp.dmine, rpt_rptscorecard_singleN, NOQUOTE)); 18996 + %if &EM_PROPERTY_CROSSTABS eq Y and "&rpt_rpm_targetLevel" ne "INTERVAL" and &colPercnum gt 0 18997 + %then %do; 18999 + ods &EM_REPORT_FORMAT text=" "; 19000 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptscorecard_crosstab_title, NOQUOTE))"; 19001 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptscorecard_crosstab_title, NOQUOTE))"; 19003 + proc tabulate data=&EM_USER_SCORECARD order=data noseps; 19004 + class displayvar rowVariable varvalue &rpt_rpm_targetName / missing; 19005 + var allfreq allPercent scorepoints colpercent frequency; 19006 + keylabel sum=" "; 19007 + table displayvar*varvalue, 19008 + (scorepoints="&tmpstr1" allfreq="&tmpstr2 &tmpstr3" allpercent="&tmpstr2 %" ) 19009 + &rpt_rpm_targetName*(frequency="&tmpstr3" colPercent="%" ) 19010 + / indent=3 rtspace=32 style=[outputwidth=100%]; 19011 + run; quit; 19012 + %end; 19013 + %else %do; 19015 + ods &EM_REPORT_FORMAT text=" "; 19016 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptrpmscorecard_title, NOQUOTE))"; 19017 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptrmpscorecard_title, NOQUOTE))"; 19019 + proc tabulate data = &EM_USER_SCORECARD order=data noseps; 19020 + class displayvar / missing; 19021 + keylabel sum=" "; 19022 + class varvalue / missing; 19023 + var scorepoints; 19024 + table displayvar*varvalue, (scorepoints="&tmpstr1")*sum 19025 + / misstext = " " indent = 3 rtspace=32; 19026 + run; quit; 19027 + %end; 19028 + %end; 19030 + /* this part definitely need review mxx*/ 19031 + %if %sysfunc(exist(&EM_USER_ScoreCard)) ne 0 and &runHP eq 1 %then %do; 19033 + %if &EM_PROPERTY_CROSSTABS eq Y and "&rpt_rpm_targetLevel" ne "INTERVAL" %then %do; 19034 + ods &EM_REPORT_FORMAT text=" "; 19035 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptscorecard_crosstab_title, NOQUOTE))"; 19036 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptscorecard_crosstab_title, NOQUOTE))"; 19037 + proc tabulate data=&EM_USER_SCORECARD order=data noseps; 19038 + class displayvar rowVariable displayLvl &rpt_rpm_targetName / MISSING; 19039 + var allfreq allPercent scorepoints colpercent frequency; 19040 + keylabel sum=" "; 19041 + table displayvar * displayLvl, (scorepoints="Scorecard Points" allfreq="Overall N" allpercent="Overall %" ) 19042 + &rpt_rpm_targetName*(frequency="N" colPercent="%" ) 19043 + / indent=3 rtspace=32 style=[outputwidth=100%]; 19044 + run; quit; 19045 + %end; 19046 + %else %do; 19047 + ods &EM_REPORT_FORMAT text=" "; 19048 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptrpmscorecard_title, NOQUOTE))"; 19049 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptrpmscorecard_title, NOQUOTE))"; 19050 + proc tabulate data = &EM_USER_SCORECARD order=data noseps; 19051 + class displayvar / MISSING; 19052 + keylabel sum=" "; 19053 + class displayLvl / missing; 19054 + var SCOREPOINTS; 19055 + table displayvar * displayLvl, (scorepoints="Scorecard Points") * sum / misstext = " " 19056 + indent = 3 rtspace=32 style=[outputwidth=50%]; 19057 + run; quit; 19058 + %end; 19059 + %end; 19060 +%end; 19062 +%if &RPM_REPORT_SCORENODE ne %then %do; 19064 + /* RPM-9. Classification matrix *********************************************************************/ 19066 + %if &EM_PROPERTY_CLASSIFICATION eq Y %then %do; 19068 + %let em_report_class = &em_lib..%sysfunc(trim(&em_report_modelid))_emclassification; 19070 + %if %sysfunc(exist(&em_report_class)) %then %do; 19072 + %EM_GETNAME(key=MISCLASS, type=DATA); 19073 + data &EM_USER_MISCLASS; 19074 + set &em_report_class; 19075 + where _TYPE_="PREDICTION" AND TARGET="&rpt_rpm_targetName"; 19076 + run; 19078 + %let numobs=0; 19079 + %let dsid = %sysfunc(open(&EM_USER_MISCLASS)); 19080 + %let numobs = %sysfunc(attrn(&dsid, NOBS)); 19081 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19083 + %if (%sysfunc(exist(&em_USER_MISCLASS)) and &numobs gt 0) %then %do; 19085 + ods &EM_REPORT_FORMAT text=" "; 19086 + %if "%nrbquote(&rpt_rpm_targetLabel)" ne "" %then %do; 19087 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptclassmatrix_title, NOQUOTE, %nrstr(&rpt_rpm_targetLabel)))"; 19088 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptclassmatrix_title, NOQUOTE, %nrstr(&rpt_rpm_targetLabel)))"; 19089 + %end; 19090 + %else %do; 19091 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptclassmatrix_title, NOQUOTE, &rpt_rpm_targetName))"; 19092 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptclassmatrix_title, NOQUOTE, &rpt_rpm_targetName))"; 19093 + %end; 19095 + proc tabulate data=&EM_USER_MISCLASS order=data noseps; 19096 + keylabel sum=" "; 19097 + class from into datarole; 19098 + var pct_col; 19099 + table from , (datarole*into='Predicted') * pct_col="" / style=[outputwidth=50%]; 19100 + run; quit; 19101 + %end; 19102 + %end; 19103 + %end; 19105 + /* RPM-10. Fit Statistics **************************************************************************/ 19107 + %if &EM_PROPERTY_FITSTAT eq Y %then %do; 19109 + %let fitdat1 =&em_lib..&RPM_REPORT_MDLCOMP._emreportfit; 19110 + %let fitdat2 =&em_lib..&em_report_modelid._emreportfit; 19112 + /* prefer to use HPREPORTSTATS table from the modeling nodel */ 19114 + %if %sysfunc(exist(&em_lib..&em_report_modelid._hpreportstats)) %then %do; 19116 + %EM_GETNAME(key=REPORTFIT, type=DATA); 19118 + data &EM_USER_REPORTFIT; 19119 + set &em_lib..&em_report_modelid._hpreportstats; 19120 + run; 19122 + %let validfit=0; 19123 + %let dsid = %sysfunc(open(&EM_USER_REPORTFIT)); 19124 + %if &dsid %then %do; 19125 + %let validnum = %sysfunc(VARNUM(&dsid, VALIDATE)); 19126 + %if &validnum %then %let validfit = 1; 19127 + %end; 19128 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19130 + ods &EM_REPORT_FORMAT text=" "; 19131 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_modelfitstat_title, NOQUOTE))"; 19132 + ods proclabel = "%sysfunc(sasmsg(sashelp.dmine, rpt_modelfitstat_title, NOQUOTE))"; 19134 + proc print data=&EM_USER_REPORTFIT label noobs style=[outputwidth=50%]; 19135 + %if &validfit eq 1 %then %do; 19136 + var Label Train Validate; 19137 + format Train 12.4 Validate 12.4; 19138 + %end; 19139 + %else %do; 19140 + var Label Train; 19141 + format Train 12.4; 19142 + %end; 19143 + run; 19144 + %end; 19145 + %else %if %sysfunc(exist(&fitdat1)) or %sysfunc(exist(&fitdat2)) %then %do; 19147 + %EM_GETNAME(key=REPORTFIT, type=DATA); 19149 + data &EM_USER_REPORTFIT; 19150 + length Label $40; 19151 + label Label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptstatistic_vlabel, NOQUOTE))"; 19152 + %if %sysfunc(exist(&fitdat1)) eq 1 19153 + %then %do; set &fitdat1; %end; 19154 + %else %do; set &fitdat2.(rename=(stat=fitstat)); %end; 19156 + if FitStat='_LIFT_' then Label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptlift10_vlabel, NOQUOTE))"; 19157 + if FitStat='_LIFTC_' then Label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptcumlift10_vlabel, NOQUOTE))"; 19158 + if FitStat='_CAP_' then Label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptcaptresp10_vlabel, NOQUOTE))"; 19159 + if FitSTat='_CAPC_' then Label="%sysfunc(sasmsg(sashelp.dmine, rpt_rptcumcaptresp10_vlabel, NOQUOTE))"; 19160 + if FitSTat='_NOBS_' then Label="%sysfunc(sasmsg(sashelp.dmine, stat_nobs_vlabel, NOQUOTE))"; 19161 + if FitSTat='_MISC_' then Label= "%sysfunc(sasmsg(sashelp.dmine, stat_misc_vlabel, NOQUOTE))"; 19162 + if FitSTat='_MAX_' then Label = "%sysfunc(sasmsg(sashelp.dmine, stat_max_vlabel, NOQUOTE))"; 19163 + if FitSTat='_SSE_' then Label= "%sysfunc(sasmsg(sashelp.dmine, stat_sse_vlabel, NOQUOTE))"; 19164 + if FitSTat='_ASE_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_ase, NOQUOTE))"; 19165 + if FitSTat='_RASE_' then Label = "%sysfunc(sasmsg(sashelp.dmine, stat_rase_vlabel, NOQUOTE))"; 19166 + if FitSTat='_DIV_' then Label = "%sysfunc(sasmsg(sashelp.dmine, stat_div_vlabel, NOQUOTE))"; 19167 + if FitSTat='_DFT_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_dft, NOQUOTE))"; 19168 + if FitSTat='_AIC_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_aic, NOQUOTE))"; 19169 + if FitSTat='_MSE_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_mse, NOQUOTE))"; 19170 + if FitSTat='_RMSE_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_rmse, NOQUOTE))"; 19171 + if FitSTat='_AVERR_' then Label = "%sysfunc(sasmsg(sashelp.dmine, stat_averr_vlabel, NOQUOTE))"; 19172 + if FitSTat='_DFE_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_dfe, NOQUOTE))"; 19173 + if FitSTat='_DFM_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_dfm, NOQUOTE))"; 19174 + if FitSTat='_ERR_' then Label= "%sysfunc(sasmsg(sashelp.dmine, stat_err_vlabel, NOQUOTE))"; 19175 + if FitSTat='_FPE_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_fpe, NOQUOTE))"; 19176 + if FitSTat='_NW_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_nw, NOQUOTE))"; 19177 + if FitSTat='_RFPE_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_rfpe, NOQUOTE))"; 19178 + if FitSTat='_SBC_' then Label = "%sysfunc(sasmsg(sashelp.dmine, rpt_fitstat_label_sbc, NOQUOTE))"; 19179 + run; 19181 + %let validfit=0; 19182 + %let dsid = %sysfunc(open(&EM_USER_REPORTFIT)); 19183 + %if &dsid %then %do; 19184 + %let validnum = %sysfunc(VARNUM(&dsid, VALIDATE)); 19185 + %if &validnum %then %let validfit = 1; 19186 + %end; 19187 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19189 + ods &EM_REPORT_FORMAT text=" "; 19190 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_modelfitstat_title, NOQUOTE))"; 19191 + ods proclabel = "%sysfunc(sasmsg(sashelp.dmine, rpt_modelfitstat_title, NOQUOTE))"; 19193 + proc print data= 19194 + %if %sysfunc(exist(&em_lib..&RPM_REPORT_MDLCOMP._emreportfit)) eq 1 19195 + %then %do; 19196 + &EM_USER_REPORTFIT(where=(MODEL="&em_report_modelId" AND TARGET="&rpt_rpm_targetName")) 19197 + %end; 19198 + %else %do; 19199 + &EM_USER_REPORTFIT(where=(TARGET="&rpt_rpm_targetName")) 19200 + %end; 19201 + label noobs style=[outputwidth=50%]; 19202 + %if &validfit eq 1 %then %do; 19203 + var Label Train Validate; 19204 + format Train 12.4 Validate 12.4; 19205 + label 19206 + train = "%sysfunc(sasmsg(sashelp.dmine, rpt_train_vlabel , NOQUOTE))" 19207 + validate = "%sysfunc(sasmsg(sashelp.dmine, rpt_validate_vlabel , NOQUOTE))" 19208 + ; 19209 + %end; 19210 + %else %do; 19211 + var Label Train; 19212 + format Train 12.4; 19213 + label train = "%sysfunc(sasmsg(sashelp.dmine, rpt_train_vlabel , NOQUOTE))"; 19214 + %end; 19215 + %if %sysfunc(exist(&em_lib..&RPM_REPORT_MDLCOMP._emreportfit)) eq 1 19216 + %then %do; 19217 + where FitStat in ('_NOBS_', '_MISC_', '_LOSS_', '_ALOSS_', '_ASE_', '_AUR_', '_GINI_', 'KS', 19218 + '_KS_PROB_CUTOFF', '_LIFT_', '_LIFTC_', '_CAP_', '_CAPC_', '_AIC_', '_AVERR_', 19219 + '_MAX_','_MSE_', '_RASE_', '_RMSE_', '_SBC_', '_SSE_') and TRAIN ne .; 19220 + %end; 19221 + %else %do; 19222 + where FitStat in ('_NOBS_', '_MISC_', '_LOSS_', '_ALOSS_', '_ASE_', '_AIC_', '_AVERR_', '_MAX_', 19223 + '_MSE_', '_RASE_', '_RMSE_', '_SBC_', '_SSE_') and TRAIN ne .; 19224 + %end; 19225 + run; 19226 + %end; 19227 + %end; 19229 + /* RPM-11. Model Comparison Table */ 19231 + %if &EM_PROPERTY_COMPAREMDL eq Y and RPM_REPORT_MDLCOMP ne %then %do; 19233 + %EM_GETNAME(KEY=COMPAREMDL, TYPE=DATA); 19235 + %let em_report_mdlOutfit = &em_lib..&RPM_REPORT_MDLCOMP._emoutfit; 19237 + %if %sysfunc(exist(&em_report_mdlOutfit)) %then %do; 19239 + /* determine model selection criterion - to included in print */ 19240 + %em_modelprops(dgmid=&em_lib, modelid=&RPM_REPORT_MDLCOMP, output=%nrbquote(work.modelprop)); 19242 + %let selectcrit = ; 19243 + data _null_; 19244 + set work.modelprop(where=(NAME="ModelCriteria")) end=eof; 19245 + if eof then call symput('selectcrit', VALUE); 19246 + run; 19248 + %let selectstat=; 19249 + %let choice = USE="Y"; 19250 + %let dsid = %sysfunc(open(&em_report_mdlOutfit(where=(&choice)))); 19251 + %if &dsid %then %do; 19252 + %let obs = %sysfunc(fetchobs(&dsid, 1)); 19253 + %let selectstat = %sysfunc(VARNAME(&dsid, 6)); 19254 + %end; 19255 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19257 + %let validflag=0; 19258 + %let dsid = %sysfunc(open(&em_lib..&RPM_REPORT_MDLCOMP._emreportfit)); 19259 + %if &dsid %then %do; 19260 + %let validnum = %sysfunc(VARNUM(&dsid, VALIDATE)); 19261 + %if &validnum %then %let validflag = 1; 19262 + %end; 19263 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19265 + data &EM_USER_COMPAREMDL; 19266 + set &em_report_mdlOutfit; 19267 + keep use model modelDescription &selectstat 19268 + %if "&rpt_rpm_targetLevel" ne "INTERVAL" %then %do; 19269 + %if &selectstat ne _LIFT_ %then %do; _LIFT_ %end; 19270 + %if &validflag eq 1 %then %do; 19271 + %if &selectstat ne _VLIFT_ %then %do; _VLIFT_ %end; 19272 + %end; 19273 + %if &selectstat ne _AIC_ %then %do; _AIC_ %end; 19274 + %end; 19275 + %else %do; 19276 + %if &selectstat ne _ASE_ %then %do; _ASE_ %end; 19277 + %if &validflag eq 1 %then %do; 19278 + %if &selectstat ne _VASE_ %then %do; _VASE_ %end; 19279 + %end; 19280 + %end; 19281 + ; 19282 + run; 19284 + ods &EM_REPORT_FORMAT text=" "; 19285 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptcomparemdl_title, NOQUOTE, &selectcrit))"; 19286 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptcomparemdl_title, NOQUOTE, &selectcrit))"; 19288 + proc print data=&EM_USER_COMPAREMDL label noobs style=[outputwidth=50%]; run; 19289 + %end; 19290 + %end; 19292 + /* RPM-12. Project Info */ 19294 + %if &EM_PROPERTY_BASICOUTPUT eq Y %then %do; 19296 + %let pos = %index(&em_nodedir, Workspaces); 19297 + %if &pos %then %do; 19299 + %let projpath = %nrbquote(%sysfunc(trim(%sysfunc(substr(&em_nodedir, 1, %eval(&pos-2)))))); 19300 + %let reverse = %nrbquote(%sysfunc(reverse(&projpath))); 19301 + %let pos2 = %index(&reverse, &em_dsep); 19302 + %let len = %length(&projpath); 19303 + %let projname = %nrbquote(%substr(&projpath, %eval(2+ &len-&pos2))); 19304 + %let projname =%nrbquote(%sysfunc(tranwrd(%nrstr(&projname), %str(%"),""))); 19305 + %let wsname = %nrbquote(%sysfunc(tranwrd(%nrstr(&em_wsname), %str(%"),""))); 19307 + %EM_GETNAME(key=PROJINFO, type=DATA); 19308 + data &EM_USER_PROJINFO; 19309 + length stat $200 value $200; 19310 + stat="%sysfunc(sasmsg(sashelp.dmine, rpt_varsel_label_name, NOQUOTE))"; 19311 + value="&projname"; 19312 + output; 19314 + stat="%sysfunc(sasmsg(sashelp.dmine, views_descriptions_diagram, NOQUOTE))"; 19315 + value="&wsname"; 19316 + output; 19318 + stat="%sysfunc(sasmsg(sashelp.dmine, rpt_rptpath_title, NOQUOTE))"; 19319 + value="&projpath"; 19320 + output; 19322 + %let createTime = %sysfunc(left(%sysfunc(putn(%sysfunc(dateTime()), NLDATM24.0)))); 19323 + stat="%sysfunc(sasmsg(sashelp.dmine, rpt_crdate_vlabel, NOQUOTE))"; 19324 + value="&createTime"; 19325 + output; 19327 + label stat="%sysfunc(sasmsg(sashelp.dmine, rpt_property_vlabel, NOQUOTE))" 19328 + value="%sysfunc(sasmsg(sashelp.dmine, rpt_rptvalue_vlabel, NOQUOTE))"; 19330 + run; 19332 + ods &EM_REPORT_FORMAT text=" "; 19333 + ods &EM_REPORT_FORMAT text="%sysfunc(sasmsg(sashelp.dmine, rpt_rptprojinfo_title, NOQUOTE))"; 19334 + ods proclabel ="%sysfunc(sasmsg(sashelp.dmine, rpt_rptprojinfo_title, NOQUOTE))"; 19336 + proc print data=&EM_USER_PROJINFO noobs label style=[outputwidth=50%]; run; 19337 + %end; 19338 + %end; 19339 +%end; 19341 +%skip: 19343 +%mend em_report_summary; 19346 +%macro em_reporter_scorecard( 19347 +/**----------------------------------------------------------------------**/ 19348 +/* EM_REPORTER_SCORECARD */ 19349 +/* generate scorecard report for EM RPM flows. currently this is an */ 19350 +/* interval macro for RPM and does not perform any argument checking. */ 19351 +/**----------------------------------------------------------------------**/ 19352 +inData = , /* input training data set */ 19353 +inData2 = , 19354 +inVariableSet = , /* input variable metadata, must have the three */ 19355 + /* columns: level, role and &name */ 19356 +name = name, /* variable name column in the metadata */ 19357 +libname = work, /* libname to save the temporary binned data */ 19358 +crosstab = Y, /* create cross-tabulation or not. Default = Y */ 19359 +targetVar = , /* target variable for regressions and scores */ 19360 +targetVar2 = , /* target variable for cross-tabulations */ 19361 +targetLevel = , /* target level */ 19362 +freqVar = , /* frequency variable */ 19363 +outVarRank = , /* output dataset for variable ranking (HPREDUCE)*/ 19364 +outScorecard = /* output dataset for scorecard report */ 19365 +/**----------------------------------------------------------------------**/ 19366 +/* Created: 08/20/2012, XXM */ 19367 +/**----------------------------------------------------------------------**/ 19368 +); 19370 +/**--------------------------------------------------------------------------------------**/ 19371 +/** 0. Configurations **/ 19372 +/**--------------------------------------------------------------------------------------**/ 19374 +** get target level; 19375 +%let targetVar = &targetVar; 19376 +%let targetVar2 = &targetVar2; 19377 +%let targetLevel = &targetLevel; 19379 +** check valid target name and level; /* TBA */ 19381 +** check VariableSet has LEVEL and NAME; /* TBA */ 19383 +/**--------------------------------------------------------------------------------------**/ 19384 +/** 1. Get the input variables from variable set **/ 19385 +/**--------------------------------------------------------------------------------------**/ 19387 +%let nom_vars = ; 19388 +%let ord_vars = ; 19389 +%let int_vars = ; 19390 +%let n_nomvars = 0; 19391 +%let n_ordvars = 0; 19392 +%let n_intvars = 0; 19394 +data _null_; 19395 + set &inVariableSet(where=(LEVEL in ('NOMINAL', 'BINARY') and upcase(&name) ne "&targetVar")) end=eof; 19396 + call symput('nom_vars'!!strip(put(_N_,BEST.)), strip(&name)); 19397 + if eof then call symput('n_nomvars', strip(put(_N_,BEST.))); 19398 +data _null_; 19399 + set &inVariableSet(where=(LEVEL='ORDINAL' and upcase(&name) ne "&targetVar")) end=eof; 19400 + call symput('ord_vars'!!strip(put(_N_,BEST.)), strip(&name)); 19401 + if eof then call symput('n_ordvars', strip(put(_N_,BEST.))); 19402 +data _null_; 19403 + set &inVariableSet(where=(LEVEL='INTERVAL' and upcase(&name) ne "&targetVar")) end=eof; 19404 + call symput('int_vars'!!strip(put(_N_,BEST.)), strip(&name)); 19405 + if eof then call symput('n_intvars', strip(put(_N_,BEST.))); 19406 +run; 19408 +%let n_svars = %eval(&n_nomvars+&n_ordvars+&n_intvars); 19410 +%if ((&n_nomvars gt 0) OR (&n_ordvars gt 0) OR (&n_intvars gt 0)) %then %do; 19412 + /**----------------------------------------------------------------------------------**/ 19413 + /** 2. PROC ARBOR **/ 19414 + /**----------------------------------------------------------------------------------**/ 19416 + proc arbor data=&indata 19417 + alpha=1 leafsize=5 mincatsize=5 maxbranch=8 maxdepth=1 NORULELIMIT 19418 + maxrules=&n_svars maxsurrs=0 missing=USEINSEARCH exhaustive=5000 19419 + ; 19420 + %if &n_nomvars gt 0 %then %do; 19421 + input %do i=1 %to &n_nomvars; &&nom_vars&i %end; / level = nominal; 19422 + %end; 19423 + %if &n_ordvars gt 0 %then %do; 19424 + input %do i=1 %to &n_ordvars; &&ord_vars&i %end; / level = ordinal; 19425 + %end; 19426 + %if &n_intvars gt 0 %then %do; 19427 + input %do i=1 %to &n_intvars; &&int_vars&i %end; / level = interval; 19428 + %end; 19429 + %if &freqvar ne %then %do; freq &freqvar; %end; 19430 + target &targetVar / level=&targetLevel; 19431 + save importance=importance rules=rules; 19432 + run; 19434 + /**----------------------------------------------------------------------------------**/ 19435 + /** 2. get VarRank output table **/ 19436 + /**----------------------------------------------------------------------------------**/ 19438 + /* keep only the top 50 input variables - based on rank */ 19440 + data &outVarRank(where=(rank le 50)); 19441 + length variable $32 worth 8; 19442 + set rules; 19443 + by rank; 19444 + retain variable worth; 19445 + label variable = "%sysfunc(sasmsg(sashelp.dmine, rpt_variable_vlabel, NOQUOTE))"; 19446 + keep variable rank worth; 19448 + if STAT="VARIABLE" then variable=Character_value; 19449 + if STAT="WORTH" then worth=Numeric_value; 19450 + if last.rank then output; 19451 + run; 19453 + data &outVarRank; 19454 + set &outVarRank; 19455 + if worth=. then do; 19456 + worth = 0.00; 19457 + rank = _N_; 19458 + end; 19459 + run; 19461 + /* selected interval and class input variables */ 19462 + proc sql noprint; 19463 + create table tempclass(drop=&name) as 19464 + select a.*, b.* from &outVarRank as a left join &inVariableSet as b 19465 + on upcase(a.variable) eq upcase(b.&name) 19466 + where level ne "INTERVAL" 19467 + order by a.variable 19468 + ; 19469 + create table tempinterval(drop=&name) as 19470 + select a.*, b.* from &outVarRank as a left join &inVariableSet as b 19471 + on upcase(a.variable) eq upcase(b.&name) 19472 + where level eq "INTERVAL" 19473 + order by a.variable 19474 + ; 19475 + quit; 19477 + /* create array of class variables names */ 19478 + %let class_vars=; 19479 + %let n_classvars=0; 19480 + data _null_; 19481 + set tempclass end=eof; 19482 + call symput('class_vars'!!strip(put(_N_,BEST.)), strip(variable)); 19483 + if eof then call symput('n_classvars', strip(put(_N_,BEST.))); 19484 + run; 19486 + /**----------------------------------------------------------------------------------**/ 19487 + /** 3. Get Bining information **/ 19488 + /**----------------------------------------------------------------------------------**/ 19490 + %let dsid = %sysfunc(open(work.rules)); 19491 + %let numobs = %sysfunc(attrn(&dsid, NOBS)); 19492 + %let numvars = %sysfunc(attrn(&dsid, NVARS)); 19493 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19495 + %if %sysfunc(exist(&outVarRank)) and (&numobs gt 0) and (&numvars gt 0) %then %do; 19497 + data rules; 19498 + set rules; 19499 + where STAT in ('VARIABLE', 'INTERVAL', 'MISSING'); 19500 + numeric_value = round(numeric_value, 0.001); 19501 + proc sort data=rules; 19502 + by rank numeric_value; 19503 + run; 19505 + data binning_rules; 19506 + length origVar $32; 19507 + set rules; 19508 + by rank; 19509 + retain origVar oldLB; 19510 + keep origVar LB UB; 19512 + if STAT="VARIABLE" then origVar = Character_value; 19513 + if first.rank then oldLB=.; 19514 + if STAT="INTERVAL" then do; 19515 + LB = oldLB; 19516 + UB = Numeric_value; 19517 + oldLB=UB; 19518 + output; 19519 + end; 19520 + if last.rank then do; 19521 + LB=oldLB; 19522 + UB = .; 19523 + output; 19524 + end; 19525 + run; 19527 + /* names for binning */ 19528 + proc sql noprint; 19529 + create table tempbinnames(drop=variable) as 19530 + select distinct origVar, role from binning_rules as a inner join tempinterval as b 19531 + on a.OrigVar eq b.variable; 19532 + quit; 19534 + /* get name server */ 19535 + proc dmdb data=tempbinnames outtable=tempbinnames nameserver; 19536 + names origVar; 19537 + prefix BIN_; 19538 + run; 19540 + /* merge binned names back to temp */ 19541 + proc sql noprint; 19542 + create table binning_rules_names as 19543 + select a.*, b.bin as binVar from binning_rules as a right join tempbinnames as b 19544 + on a.origVar eq b.origVar 19545 + order by a.origVar, a.LB, a.UB; 19546 + quit; 19548 + /* create array of bin variables names */ 19549 + %let bin_vars=; 19550 + %let n_binvars=0; 19551 + data _null_; 19552 + set tempbinnames end=eof; 19553 + call symput('bin_vars'!!strip(put(_N_,BEST.)), strip(bin)); 19554 + if eof then call symput('n_binvars', strip(put(_N_,BEST.))); 19555 + run; 19557 + /**----------------------------------------------------------------------------------**/ 19558 + /** 4. Bin the interval variables **/ 19559 + /** note that binned is used for DMREG, binned_full is used for CROSSTAB **/ 19560 + /**----------------------------------------------------------------------------------**/ 19562 + data binned; 19563 + set &indata; 19565 + %if &n_binvars gt 0 %then %do; 19566 + length %do i=1 %to &n_binvars; &&bin_vars&i %end; $50; 19567 + %end; 19569 + %let dsid = %sysfunc(open(binning_rules_names)); 19570 + %if &dsid %then %do; 19571 + %let orignum = %sysfunc(VARNUM(&dsid, origVar)); 19572 + %let binnum = %sysfunc(VARNUM(&dsid, binVar)); 19573 + %let lbnum = %sysfunc(VARNUM(&dsid, LB)); 19574 + %let ubnum = %sysfunc(VARNUM(&dsid, UB)); 19576 + %let obs = %sysfunc(fetch(&dsid)); 19577 + %do %while(&obs=0); 19578 + %let origvar = %sysfunc(getvarc(&dsid, &orignum)); 19579 + %let binvar = %sysfunc(getvarc(&dsid, &binnum)); 19580 + %let lb = %sysfunc(getvarn(&dsid, &lbnum)); 19581 + %let ub = %sysfunc(getvarn(&dsid, &ubnum)); 19583 + %if "&lb" eq "." AND "&ub" ne "." %then %do; 19584 + %let count = 1; 19585 + if &origvar < &ub then &binvar = "&count: low - &ub"; 19586 + %end; 19587 + %else %if "&lb" ne "." AND "&ub" eq "." %then %do; 19588 + %let count = %eval(&count+1); 19589 + else if &origvar >= &lb then &binvar = "&count: &lb - high"; 19590 + %end; 19591 + %else %if "&lb" eq "." AND "&ub" eq "." %then %do; 19592 + %let count = 1; 19593 + &binvar = "&count: low - high"; 19594 + %end; 19595 + %else %do; 19596 + %let count = %eval(&count+1); 19597 + else if &origvar < &ub AND &origvar >= &lb then &binvar = "&count: &lb - &ub"; 19598 + %end; 19600 + %let obs = %sysfunc(fetch(&dsid)); 19601 + %end; 19602 + %end; 19603 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19604 + run; 19606 + data binned_full; 19607 + set &indata2; 19609 + %if &n_binvars gt 0 %then %do; 19610 + length %do i=1 %to &n_binvars; &&bin_vars&i %end; $50; 19611 + %end; 19613 + %let dsid = %sysfunc(open(binning_rules_names)); 19614 + %if &dsid %then %do; 19615 + %let orignum = %sysfunc(VARNUM(&dsid, origVar)); 19616 + %let binnum = %sysfunc(VARNUM(&dsid, binVar)); 19617 + %let lbnum = %sysfunc(VARNUM(&dsid, LB)); 19618 + %let ubnum = %sysfunc(VARNUM(&dsid, UB)); 19620 + %let obs = %sysfunc(fetch(&dsid)); 19621 + %do %while(&obs=0); 19622 + %let origvar = %sysfunc(getvarc(&dsid, &orignum)); 19623 + %let binvar = %sysfunc(getvarc(&dsid, &binnum)); 19624 + %let lb = %sysfunc(getvarn(&dsid, &lbnum)); 19625 + %let ub = %sysfunc(getvarn(&dsid, &ubnum)); 19627 + %if "&lb" eq "." AND "&ub" ne "." %then %do; 19628 + %let count = 1; 19629 + if &origvar < &ub then &binvar = "&count: low - &ub"; 19630 + %end; 19631 + %else %if "&lb" ne "." AND "&ub" eq "." %then %do; 19632 + %let count = %eval(&count+1); 19633 + else if &origvar >= &lb then &binvar = "&count: &lb - high"; 19634 + %end; 19635 + %else %if "&lb" eq "." AND "&ub" eq "." %then %do; 19636 + %let count = 1; 19637 + &binvar = "&count: low - high"; 19638 + %end; 19639 + %else %do; 19640 + %let count = %eval(&count+1); 19641 + else if &origvar < &ub AND &origvar >= &lb then &binvar = "&count: &lb - &ub"; 19642 + %end; 19644 + %let obs = %sysfunc(fetch(&dsid)); 19645 + %end; 19646 + %end; 19647 + %if &dsid %then %let dsid = %sysfunc(close(&dsid)); 19648 + run; 19650 + /**----------------------------------------------------------------------------------**/ 19651 + /** 5. Generate scores **/ 19652 + /**----------------------------------------------------------------------------------**/ 19654 + proc dmdb batch data=binned dmdbcat=score_dmdb maxlevel=513 classout=_classout; 19655 + class 19656 + %if &n_classvars gt 0 %then %do; %do i=1 %to &n_classvars; &&class_vars&i %end; %end; 19657 + %if &n_binvars gt 0 %then %do; %do i=1 %to &n_binvars; &&bin_vars&i %end; %end; 19658 + %if "&targetLevel" ne "INTERVAL" %then %do; &targetVar %end; 19659 + ; 19660 + %if &freqvar ne %then %do; freq &freqvar; %end; 19661 + %if "&targetLevel" eq "INTERVAL" %then %do; var &targetVar; %end; 19662 + target &targetVar; 19663 + run; quit; 19665 + proc dmreg data=binned dmdbcat=score_dmdb outest=coeff_est outterms=outterms noprint descending; 19666 + class 19667 + %if &n_classvars gt 0 %then %do; %do i=1 %to &n_classvars; &&class_vars&i %end; %end; 19668 + %if &n_binvars gt 0 %then %do; %do i=1 %to &n_binvars; &&bin_vars&i %end; %end; 19669 + %if "&targetLevel" ne "INTERVAL" %then %do; &targetVar %end; 19670 + ; 19671 + %if &freqvar ne %then %do; freq &freqvar; %end; 19672 + model &targetVar = 19673 + %if &n_classvars gt 0 %then %do; %do i=1 %to &n_classvars; &&class_vars&i %end; %end; 19674 + %if &n_binvars gt 0 %then %do; %do i=1 %to &n_binvars; &&bin_vars&i %end; %end; 19675 + / coding=glm 19676 + ; 19677 + run; 19679 + proc sql noprint; 19680 + create table _score_tmp1 as 19681 + select *, min(coefficient) as min_est, 19682 + case when calculated min_est = coefficient then 0 19683 + else coefficient-calculated min_est 19684 + end as est1 19685 + from outterms 19686 + where variable ne 'Intercept' 19687 + group by variable 19688 + ; 19689 + create table _score_tmp2 as 19690 + select *, max(est1) as max_est1, count(*) as counter 19691 + from _score_tmp1 19692 + group by variable 19693 + ; 19694 + create table &outScorecard(rename=(classlevel=value)) as 19695 + select *, sum(max_est1/counter) as sum_max, 19696 + case when est1=max_est1 then 1 else 0 end as max_cat, 19697 + round(1000*((est1) / calculated sum_max)) as score 19698 + from _score_tmp2 19699 + order by variable, classlevel 19700 + ; 19701 + create table _classout2(rename=(name=variable level=value)) as 19702 + select a.*, b.format 19703 + from _classout as a left join &inVariableSet(keep=&name format) as b 19704 + on a.name eq b.&name 19705 + order by a.name, a.level 19706 + ; 19707 + quit; 19709 + data &outScorecard; 19710 + merge &outScorecard(in=_a) _classout2; 19711 + by variable value; 19712 + if _a; 19713 + value = tranwrd(value, "'", "''"); 19714 + rename frequency = AllFreq 19715 + freqpercent = AllPercent; 19716 + label score = "%sysfunc(sasmsg(sashelp.dmine, rpt_scorecardpoints_vlabel, NOQUOTE))" 19717 + frequency = "%sysfunc(sasmsg(sashelp.dmine, rpt_numObs_vlabel, NOQUOTE))" 19718 + freqpercent = "%sysfunc(sasmsg(sashelp.dmine, rpt_rptperctobs_vlabel, NOQUOTE))"; 19719 + run; 19721 + /* replace binned named with original var name instead */ 19723 + proc sort data=tempbinnames; by bin; run; 19725 + data &outScorecard; 19726 + merge &outScorecard(in=_a) tempbinnames(rename=(bin=variable origvar=displayVar)) ; 19727 + by variable; 19728 + if _a; 19729 + if displayVar="" then displayVar=variable; 19730 + run; 19732 + /**----------------------------------------------------------------------------------**/ 19733 + /** 6. Generate crosstabs **/ 19734 + /**----------------------------------------------------------------------------------**/ 19736 + %if "&targetLevel" ne "INTERVAL" %then %do; 19738 + ods &EM_REPORT_FORMAT exclude all; 19739 + ods listing; 19741 + data _null_; 19742 + set &outScorecard end=eof; 19743 + by variable; 19744 + if _n_=1 then call execute("proc freq data=work.binned_full order=formatted addnames;"); 19745 + if first.variable then call execute("table "||variable||" * &targetVar2 / missing;"); 19746 + if eof then do; 19747 + %if &freqvar ne %then %do; call execute("weight &freqvar;"); %end; 19748 + call execute("ods output crosstabfreqs=tempfreq;"); 19749 + call execute("run;"); 19750 + end; 19751 + run; 19753 + data _null_; 19754 + set &outScorecard end=eof; 19755 + by variable value; 19757 + if _n_=1 then do; 19758 + call execute("data crosstabs;"); 19759 + call execute(" length varvalue $200 displayVar $32;"); 19760 + call execute(" set tempfreq(where=(_type_='11'));"); 19761 + end; 19763 + if type="N" AND format eq "" then do; 19764 + call execute("if "||Variable||" = "||value||" then do;"); 19765 + end; 19766 + else do; 19767 + if format ne "" 19768 + then call execute("%DMNORMCP(put("||variable||","||format||"), _normvar);"); 19769 + else call execute("%DMNORMCP("||variable||", _normvar);"); 19770 + call execute("if strip(_normvar) = '"||strip(value)||"' then do;"); 19771 + end; 19773 + call execute(" varvalue='"||strip(value)||"';"); 19774 + call execute(" scorepoints="||score||";"); 19775 + call execute(" allfreq="||allfreq||";"); 19776 + call execute(" allpercent="||allpercent||";"); 19777 + call execute(" displayVar='"||displayVar||"';"); 19778 + call execute("end;"); 19780 + if eof then call execute("run;"); 19781 + run; 19783 + ods &EM_REPORT_FORMAT select all; 19784 + ods listing close; 19786 + proc sort data=crosstabs; by rowVariable varvalue; run; 19788 + data &outScoreCard; 19789 + set crosstabs; 19790 + by rowVariable varvalue; 19791 + if missing(scorepoints) then delete; 19792 + if ^first.varvalue then do; 19793 + scorepoints=.; 19794 + allfreq=.; 19795 + allpercent=.; 19796 + end; 19797 + keep displayvar rowVariable varValue &targetVar2 scorepoints frequency colPercent allfreq allpercent ; 19798 + run; 19799 + %end; 19800 + %else %do; 19801 + data &outScoreCard; 19802 + set &outScoreCard; 19803 + rename value=varvalue score=scorepoints; 19804 + run; 19805 + %end; 19806 +%end; 19808 +/* proc datasets lib=work nolist;*/ 19809 +/* run; quit;*/ 19810 +%end; 19812 +%mend em_reporter_scorecard; NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.EM_GETTRAINPATH.SOURCE. 19813 +%macro EM_GETTRAINPATH(NODEID=, OUTPATH=); 19814 + proc display c=sashelp.emcore.pathscorecode.scl; 19815 + run; 19816 +%mend EM_GETTRAINPATH; 19817 + NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: %INCLUDE (level 1) file TEMP is file SASHELP.EMUTIL.REPORTER_TAGSET_TEMPLATE.SOURCE. 19818 +Ods path(prepend) work.templat(update); 19819 + 19820 +/* emgraph.tpl */ 19821 +proc template; 19822 +define tagset tagsets.gtl / store=work.templat; 19823 +parent=tagsets.odsgraph; 19824 +%let map =<>%nrstr(&)%str(%')%str(%"); 19825 +map="&map"; 19826 +mapsub = '/</>/&/'/"/'; 19827 +nobreakspace = ' ' no_byte_order_mark = yes; 19828 +split = '
'; 19829 +output_type = 'xml'; 19830 +indent=2; 19831 + 19832 +define event options_set; 19833 + do / if $options['X']; 19834 + set $xvar $options['X']; 19835 + else; 19836 + unset $xvar; 19837 + done; 19838 + 19839 + do / if $options['Y']; 19840 + set $yvar $options['Y']; 19841 + else; 19842 + unset $yvar; 19843 + done; 19844 + 19845 + do / if $options['CATEGORY']; 19846 + set $category $options['CATEGORY']; 19847 + else; 19848 + unset $category; 19849 + done; 19850 + 19851 + do / if $options['RESPONSE']; 19852 + set $response $options['RESPONSE']; 19853 + else; 19854 + unset $response; 19855 + done; 19856 + 19857 + do / if $options['LIMITUPPER']; 19858 + set $limitupper $options['LIMITUPPER']; 19859 + else; 19860 + unset $limitupper; 19861 + done; 19862 + 19863 + do / if $options['LIMITLOWER']; 19864 + set $limitlower $options['LIMITLOWER']; 19865 + else; 19866 + unset $limitlower; 19867 + done; 19868 + 19869 + do / if $options['WIDTH']; 19870 + set $graphwidth $options['WIDTH']; 19871 + else; 19872 + unset $graphwidth; 19873 + done; 19874 + 19875 + do / if $options['HEIGHT']; 19876 + set $graphheight $options['HEIGHT']; 19877 + else; 19878 + unset $graphheight; 19879 + done; 19880 + 19881 + do / if $options['ROWS']; 19882 + set $rows $options['ROWS']; 19883 + else; 19884 + unset $rows; 19885 + done; 19886 + 19887 + do / if $options['COLUMNS']; 19888 + set $columns $options['COLUMNS']; 19889 + else; 19890 + unset $columns; 19891 + done; 19892 + 19893 + do / if $options['TITLE']; 19894 + set $title $options['TITLE']; 19895 + else; 19896 + unset $title; 19897 + done; 19898 + 19899 + do / if $options['TITLE2']; 19900 + set $title2 $options['TITLE2']; 19901 + else; 19902 + unset $title2; 19903 + done; 19904 + 19905 +do / if $options['TITLE3']; 19906 + set $title3 $options['TITLE3']; 19907 + else; 19908 + unset $title3; 19909 + done; 19910 + 19911 +do / if $options['TITLE4']; 19912 + set $title4 $options['TITLE4']; 19913 + else; 19914 + unset $title4; 19915 + done; 19916 + 19917 + do / if $options['ID']; 19918 + set $id $options['ID']; 19919 + else; 19920 + unset $id; 19921 + done; 19922 + 19923 + do / if $options['PARENT']; 19924 + set $parent $options['PARENT']; 19925 + else; 19926 + unset $parent; 19927 + done; 19928 + 19929 + do / if $options['PARENT']; 19930 + set $parent $options['PARENT']; 19931 + else; 19932 + unset $parent; 19933 + done; 19934 + 19935 + do / if $options['ABOVETEXT']; 19936 + set $abovetext $options['ABOVETEXT']; 19937 + else; 19938 + unset $abovetext; 19939 + done; 19940 + 19941 + do / if $options['BELOWTEXT']; 19942 + set $belowtext $options['BELOWTEXT']; 19943 + else; 19944 + unset $belowtext; 19945 + done; 19946 + 19947 + do / if $options['LINKWIDTH']; 19948 + set $linkwidth $options['LINKWIDTH']; 19949 + else; 19950 + unset $linkwidth; 19951 + done; 19952 + 19953 + do / if $options['NODECOLOR']; 19954 + set $nodecolor $options['NODECOLOR']; 19955 + else; 19956 + unset $nodecolor; 19957 + done; 19958 + 19959 + do / if $options['NODESIZE']; 19960 + set $nodesize $options['NODESIZE']; 19961 + else; 19962 + unset $nodesize; 19963 + done; 19964 + 19965 + do / if $options['NODETEXT']; 19966 + set $nodetext $options['NODETEXT']; 19967 + else; 19968 + unset $nodetext; 19969 + done; 19970 + 19971 + do / if $options['PFDITEMS']; 19972 + set $pfditems $options['PFDITEMS']; 19973 + else; 19974 + unset $pfditems; 19975 + done; 19976 + 19977 + do / if $options['GRIDSTYLE']; 19978 + set $gridstyle $options['GRIDSTYLE']; 19979 + else; 19980 + unset $gridstyle; 19981 + done; 19982 + 19983 + do / if $options['GRIDHEIGHT']; 19984 + set $gridheight $options['GRIDHEIGHT']; 19985 + else; 19986 + unset $gridheight; 19987 + done; 19988 + 19989 + do / if $options['GRIDWIDTH']; 19990 + set $gridwidth $options['GRIDWIDTH']; 19991 + else; 19992 + unset $gridwidth; 19993 + done; 19994 + 19995 + do / if $options['ISGRIDVISIBLE']; 19996 + set $isGridVisible $options['ISGRIDVISIBLE']; 19997 + else; 19998 + unset $isGridVisible; 19999 + done; 20000 + 20001 + do / if $options['LAYOUTACTIVATED']; 20002 + set $layoutActivated $options['LAYOUTACTIVATED']; 20003 + else; 20004 + unset $layoutActivated; 20005 + done; 20006 + 20007 + do / if $options['PIELABELDISPLAY']; 20008 + set $pieLabelDisplay $options['PIELABELDISPLAY']; 20009 + else; 20010 + unset $pieLabelDisplay; 20011 + done; 20012 + 20013 + do / if $options['COLORLIST']; 20014 + set $colorlist $options['COLORLIST']; 20015 + else; 20016 + unset $colorlist; 20017 + done; 20018 + 20019 + do / if $options['COLORINDEX']; 20020 + set $colorindex $options['COLORINDEX']; 20021 + else; 20022 + unset $colorindex; 20023 + done; 20024 + 20025 +end; 20026 + 20027 +define event doc; 20028 + eval $silkindex 0; 20029 + eval $level 0; 20030 +end; 20031 + 20032 +define event GraphStyle; 20033 + pure_style; 20034 + trigger StatXMLDecl; 20035 + put '' CR; 20036 + put '' CR; 20037 + trigger StatGraphScheme start; 20038 + trigger StatDataDefaultScheme; 20039 + trigger StatTwoColorRampScheme; 20040 + trigger StatTwoColorAltRampScheme; 20041 + trigger StatThreeColorRampScheme; 20042 + trigger StatThreeColorAltRampScheme; 20043 + trigger StatAxisLineScheme; 20044 + trigger StatReferenceScheme; 20045 + trigger StatGridLineScheme; 20046 + trigger StatOutlineScheme; 20047 + trigger StatBorderLineScheme; 20048 + trigger StatTitleTextScheme; 20049 + trigger StatFootnoteTextScheme; 20050 + trigger StatDataTextScheme; 20051 + trigger StatLabelTextScheme; 20052 + trigger StatValueTextScheme; 20053 + trigger StatUnicodeTextScheme; 20054 + trigger StatBackFillScheme; 20055 + trigger StatWallFillScheme; 20056 + trigger StatFloorFillScheme; 20057 + trigger StatLegendFillScheme; 20058 + trigger StatHeaderFillScheme; 20059 + trigger StatOutlierScheme; 20060 + trigger StatFitScheme; 20061 + trigger StatFit2Scheme; 20062 + trigger StatPredictionScheme; 20063 + trigger StatConfidenceScheme; 20064 + trigger StatConfidence2Scheme; 20065 + trigger StatPredictionLimitsScheme; 20066 + trigger StatErrorScheme; 20067 + trigger StatBoxMedianScheme; 20068 + trigger StatBoxMeanScheme; 20069 + trigger StatBoxWhiskerScheme; 20070 + trigger StatBoxScheme; 20071 + trigger StatHistogramScheme; 20072 + trigger StatBandScheme; 20073 + trigger StatContourScheme; 20074 + trigger StatEllipseScheme; 20075 + trigger StatAnnoLineScheme; 20076 + trigger StatAnnoTextScheme; 20077 + trigger StatAnnoShapeScheme; 20078 + trigger StatSelectionScheme; 20079 + trigger StatConnectLineScheme; 20080 + trigger StatMissingScheme; 20081 + trigger StatControlLimitsScheme; 20082 + trigger StatRunTestScheme; 20083 + trigger StatStarsScheme; 20084 + trigger StatClippingScheme; 20085 + trigger StatBlockScheme; 20086 + trigger StatAltBlockScheme; 20087 + trigger GraphDataStyle1; 20088 + trigger GraphDataStyle2 / if !$stopDataStyles; 20089 + trigger GraphDataStyle3 / if !$stopDataStyles; 20090 + trigger GraphDataStyle4 / if !$stopDataStyles; 20091 + trigger GraphDataStyle5 / if !$stopDataStyles; 20092 + trigger GraphDataStyle6 / if !$stopDataStyles; 20093 + trigger GraphDataStyle7 / if !$stopDataStyles; 20094 + trigger GraphDataStyle8 / if !$stopDataStyles; 20095 + trigger GraphDataStyle9 / if !$stopDataStyles; 20096 + trigger GraphDataStyle10 / if !$stopDataStyles; 20097 + trigger GraphDataStyle11 / if !$stopDataStyles; 20098 + trigger GraphDataStyle12 / if !$stopDataStyles; 20099 + trigger GraphDataStyle13 / if !$stopDataStyles; 20100 + trigger GraphDataStyle14 / if !$stopDataStyles; 20101 + trigger GraphDataStyle15 / if !$stopDataStyles; 20102 + trigger StatGraphScheme finish; 20103 + put '' CR; 20104 + unset $stopDataStyles; 20105 +end; 20106 + 20107 +%macro dataStyleAttrs(index); 20108 + do / if !any(LINESTYLE, CONTRASTCOLOR, MARKERSYMBOL, COLOR); 20109 + set $stopDataStyles 'true'; 20110 + break; 20111 + done; 20112 + put '" NL; 20122 +%mend; 20123 + 20124 + define event GraphDataStyle1; 20125 + pure_style; 20126 + style=GraphData1; 20127 + %dataStyleAttrs(1); 20128 + end; 20129 + define event GraphDataStyle2; 20130 + pure_style; 20131 + style=GraphData2; 20132 + %dataStyleAttrs(2); 20133 + end; 20134 +define event GraphDataStyle3; 20135 + pure_style; 20136 + style=GraphData3; 20137 + %dataStyleAttrs(3); 20138 + end; 20139 + define event GraphDataStyle4; 20140 + pure_style; 20141 + style=GraphData4; 20142 + %dataStyleAttrs(4); 20143 + end; 20144 + define event GraphDataStyle5; 20145 + pure_style; 20146 + style=GraphData5; 20147 + %dataStyleAttrs(5); 20148 + end; 20149 + define event GraphDataStyle6; 20150 + pure_style; 20151 + style=GraphData6; 20152 + %dataStyleAttrs(6); 20153 + end; 20154 + define event GraphDataStyle7; 20155 + pure_style; 20156 + style=GraphData7; 20157 + %dataStyleAttrs(7); 20158 + end; 20159 + define event GraphDataStyle8; 20160 + pure_style; 20161 + style=GraphData8; 20162 + %dataStyleAttrs(8); 20163 + end; 20164 + define event GraphDataStyle9; 20165 + pure_style; 20166 + style=GraphData9; 20167 + %dataStyleAttrs(9); 20168 + end; 20169 + define event GraphDataStyle10; 20170 + pure_style; 20171 + style=GraphData10; 20172 + %dataStyleAttrs(10); 20173 + end; 20174 + define event GraphDataStyle11; 20175 + pure_style; 20176 + style=GraphData11; 20177 + %dataStyleAttrs(11); 20178 + end; 20179 + define event GraphDataStyle12; 20180 + pure_style; 20181 + style=GraphData12; 20182 + %dataStyleAttrs(12); 20183 + end; 20184 + define event GraphDataStyle13; 20185 + pure_style; 20186 + style=GraphData13; 20187 + %dataStyleAttrs(13); 20188 + end; 20189 + define event GraphDataStyle14; 20190 + pure_style; 20191 + style=GraphData14; 20192 + %dataStyleAttrs(14); 20193 + end; 20194 + define event GraphDataStyle15; 20195 + pure_style; 20196 + style=GraphData15; 20197 + %dataStyleAttrs(15); 20198 + end; 20199 + 20200 +define event BeginGraph; 20201 +putlog "BeginGraph"; 20202 + trigger GraphStyle; 20203 + put '' CR; 20204 + put '' CR; 20211 + set $graph_started "true"; 20212 + eval $level 0; 20213 +end; 20214 + 20215 +define event LayoutOverlay; 20216 + start: 20217 + trigger BeginGraph / if !$graph_started; 20218 + put '' $title '' CR / if $title; 20219 + put '' $title2 '' CR / if $title2; 20220 + put '' $title3'' CR / if $title3; 20221 + put '' $title4 '' CR / if $title4; 20222 + put '' CR; 20223 + eval $level $level+1; 20224 + unset $title; 20225 + unset $title2; 20226 + unset $title3; 20227 + unset $title4; 20228 + finish: 20229 + put '' CR; 20230 + eval $level $level-1; 20231 + trigger EndGraph / if $level=0; 20232 +end; 20233 + 20234 +define event LayoutRegion; 20235 + start: 20236 + trigger BeginGraph / if !$graph_started; 20237 + put '' $title '' CR / if $title; 20238 + put '' $title2 '' CR / if $title2; 20239 + put '' $title3'' CR / if $title3; 20240 + put '' $title4 '' CR / if $title4; 20241 + put '' CR; 20242 + eval $level $level+1; 20243 + unset $title; 20244 + unset $title2; 20245 + unset $title3; 20246 + unset $title4; 20247 + finish: 20248 + put '' CR; 20249 + eval $level $level-1; 20250 + trigger EndGraph / if $level=0; 20251 +end; 20252 + 20253 +define event LayoutLattice; 20254 + start: 20255 + trigger BeginGraph / if !$graph_started; 20256 + put '" CR; 20289 + unset $graph_started; 20290 +end; 20291 + 20292 +define event ScatterPlot; 20293 + put '' CR; 20297 + unset $xvar; 20298 + unset $yvar; 20299 +end; 20300 + 20301 +define event SeriesPlot; 20302 + put '' CR; 20306 + unset $xvar; 20307 + unset $yvar; 20308 +end; 20309 + 20310 +define event BandPlot; 20311 + put '' CR; 20337 + unset $category; 20338 + unset $response; 20339 +end; 20340 + 20341 +define event Histogram; 20342 + put '' CR; 20345 + unset $xvar; 20346 +end; 20347 + 20348 +define event DecisionTree; 20349 + put '' CR; 20360 + unset $id; 20361 + unset $parent; 20362 + unset $abovetext; 20363 + unset $belowtext; 20364 + unset $linkwidth; 20365 + unset $nodecolor; 20366 + unset $nodetext; 20367 +end; 20368 + 20369 +define event Icicle; 20370 + put '' CR; 20376 + unset $id; 20377 + unset $parent; 20378 + unset $nodecolor; 20379 + unset $nodesize; 20380 +end; 20381 + 20382 +define event PFD; 20383 + put '' CR; 20407 + trigger EndGraph / if $level=0; 20408 + unset $xvar; 20409 + unset $yvar; 20410 + unset $response; 20411 + unset $colorlist; 20412 + unset $colorindex; 20413 +end; 20414 + 20415 +end; NOTE: TAGSET 'Tagsets.Gtl' has been saved to: WORK.TEMPLAT 20416 +run; NOTE: PROCEDURE TEMPLATE used (Total process time): real time 0.01 seconds cpu time 0.03 seconds 20417 + 20418 + 20419 + 20420 + 20421 + 20422 + 20423 +/* data_template.sas */ 20424 +proc template; 20425 +define statgraph dataonly / store=work.templat; 20426 +dynamic dummy1 dummy2 var1 var2 var3 var4 var5 var6 var7 var8 var9 var10; 20427 +begingraph; 20428 +if (0) 20429 +layout overlay; 20430 + scatterplot x=dummy1 y=dummy2 / 20431 + rolename=(a=var1 b=var2 c=var3 d=var4 e=var5 f=var6 g=var7 h=var8 i=var9 j=var10); 20432 +endlayout; 20433 +endif; 20434 +endgraph; 20435 +end; NOTE: STATGRAPH 'Dataonly' has been saved to: WORK.TEMPLAT 20436 +run; NOTE: PROCEDURE TEMPLATE used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 20437 + NOTE: %INCLUDE (level 1) ending. NOTE: Fileref TEMP has been deassigned. NOTE: There were 1 observations read from the data set EMWS5.EM_NODEID. WHERE UPCASE(STRIP(nodeid))='REPORT'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: The data set WORK.EM_USER_KEY has 1 observations and 8 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 20438 data emreportpath; 20439 length nodelabel $32 component $32; 20440 nodelabel="Ids"; 20441 component="DataSource"; 20442 output; 20443 nodelabel="Part"; 20444 component="Partition"; 20445 output; 20446 nodelabel="Ids2"; 20447 component="DataSource"; 20448 output; 20449 nodelabel="Part2"; 20450 component="Partition"; 20451 output; 20452 nodelabel="Ids3"; 20453 component="DataSource"; 20454 output; 20455 nodelabel="Part3"; 20456 component="Partition"; 20457 output; 20458 nodelabel="HPDMForest"; 20459 component="HPDMForest"; 20460 output; 20461 nodelabel="HPDMForest2"; 20462 component="HPDMForest"; 20463 output; 20464 nodelabel="HPDMForest3"; 20465 component="HPDMForest"; 20466 output; 20467 nodelabel="MdlComp"; 20468 component="ModelCompare"; 20469 output; 20470 nodelabel="Score"; 20471 component="Score"; 20472 output; 20473 run; NOTE: The data set WORK.EMREPORTPATH has 11 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: PROCEDURE DISPLAY used (Total process time): real time 0.03 seconds cpu time 0.01 seconds NOTE: There were 11 observations read from the data set WORK.EMREPORTPATH. NOTE: The data set WORK.EMREPORTPATH has 11 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: STYLE 'Styles.Em_style' has been saved to: WORK.TEMPLAT NOTE: PROCEDURE TEMPLATE used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: Writing ODS PDF output to DISK destination "\\kramer\sas\SFM_SAS\PredictiveModeling\PredictiveModelingCPM\CPM_EM\CPM_Trees\Workspaces\ EMWS5\Report\REPORT.pdf", printer "PDF". NOTE: This SAS session is using a registry in WORK. All changes will be lost at the end of this session. NOTE: There were 1 observations read from the data set EMWS5.EM_DGRAPH. WHERE to='Report'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds WARNING: Argument 3 to macro function %SUBSTR is out of range. NOTE: There were 1 observations read from the data set EMWS5.EM_DGRAPH. WHERE to='Score'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 1 observations read from the data set EMWS5.MDLCOMP_EMOUTFIT. WHERE USE='Y'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 1 observations read from the data set EMWS5.MDLCOMP_EMOUTFIT. WHERE USE='Y'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: The data set EMWS5.REPORT_MODELINFO has 1 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.05 seconds cpu time 0.00 seconds NOTE: 0 lines were written to file PRINT. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: Fileref X has been deassigned. NOTE: There were 3 observations read from the data set WORK.EMREPORTPATH. WHERE SUBSTR(UPCASE(STRIP(nodeid)), 1, 3)='IDS'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 139:121 142:124 NOTE: There were 1 observations read from the data set EMWS5.IDS3_EMTMETADEFAULT. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 1 observations read from the data set EMWS5.HPDMFOREST_VARIABLESET. WHERE (role='TARGET') and (use='Y'); NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.00 seconds NOTE: There were 4 observations read from the data set EMWS5.HPDMFOREST_EMINFO. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 13 observations read from the data set EMWS5.IDS_EXPLODE_DM. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 13 observations read from the data set EMWS5.IDS_EXPLODE_DM. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 13 observations read from the data set EMWS5.IDS_EXPLODE_DM. NOTE: The data set EMWS5.REPORT_TARGETINFO has 13 observations and 10 variables. NOTE: DATA statement used (Total process time): real time 0.06 seconds cpu time 0.00 seconds NOTE: There were 0 observations read from the data set EMWS5.HPDMFOREST_VARIABLESET. WHERE role='FREQ'; NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.00 seconds NOTE: There were 1 observations read from the data set WORK.EM_USER_KEY. NOTE: The data set WORK.EM_USER_KEY has 2 observations and 8 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 2 observations read from the data set WORK.EM_USER_KEY. NOTE: The data set WORK.EM_USER_KEY has 3 observations and 8 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 1093 observations read from the data set EMWS5.IDS3_VARIABLESET. WHERE UPCASE(role)='INPUT'; NOTE: The data set EMWS5.REPORT_TEMPVAR has 1093 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.06 seconds cpu time 0.03 seconds NOTE: PROCEDURE SQL used (Total process time): real time 0.01 seconds cpu time 0.01 seconds NOTE: There were 1093 observations read from the data set EMWS5.REPORT_TEMPVAR. NOTE: The data set EMWS5.REPORT_TEMPVAR has 1093 observations and 2 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.03 seconds cpu time 0.00 seconds NOTE: Input data set is already sorted; it has been copied to the output data set. NOTE: There were 1115 observations read from the data set EMWS5.IDS3_EMCMETADEFAULT. NOTE: The data set WORK.TEMPMETA has 1115 observations and 21 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.02 seconds cpu time 0.00 seconds NOTE: There were 1093 observations read from the data set EMWS5.REPORT_TEMPVAR. NOTE: There were 1115 observations read from the data set WORK.TEMPMETA. NOTE: The data set EMWS5.REPORT_TEMPMETA has 1093 observations and 21 variables. NOTE: DATA statement used (Total process time): real time 0.06 seconds cpu time 0.03 seconds NOTE: Deleting WORK.TEMPMETA (memtype=DATA). NOTE: PROCEDURE DELETE used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: The data set EMWS5.REPORT_DATASUM has 6 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.05 seconds cpu time 0.01 seconds NOTE: There were 6 observations read from the data set EMWS5.REPORT_DATASUM. NOTE: PROCEDURE PRINT used (Total process time): real time 0.01 seconds cpu time 0.00 seconds NOTE: There were 1 observations read from the data set EMWS5.IDS_EXPLODE_DM. WHERE _type_='MATRIX'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 1 observations read from the data set EMWS5.IDS_EXPLODE_DM. WHERE _type_='DECPRIOR'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 2 observations read from the data set EMWS5.IDS_EXPLODE_DD. NOTE: The data set EMWS5.REPORT_TARGETSUM has 2 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 0.08 seconds cpu time 0.03 seconds NOTE: There were 2 observations read from the data set EMWS5.REPORT_TARGETSUM. NOTE: PROCEDURE PRINT used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: Table WORK.TEMPSELECTED created, with 1115 rows and 22 columns. NOTE: Table EMWS5.REPORT_VARSUM created, with 7 rows and 4 columns. NOTE: PROCEDURE SQL used (Total process time): real time 0.10 seconds cpu time 0.04 seconds NOTE: There were 7 observations read from the data set EMWS5.REPORT_VARSUM. NOTE: The data set EMWS5.REPORT_VARSUM has 7 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.07 seconds cpu time 0.04 seconds NOTE: There were 7 observations read from the data set EMWS5.REPORT_VARSUM. NOTE: PROCEDURE PRINT used (Total process time): real time 0.02 seconds cpu time 0.01 seconds NOTE: Deleting WORK.TEMPSELECTED (memtype=DATA). NOTE: PROCEDURE DELETE used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: EXPLOREOBS EMWS5.HPDMForest_train : vars= 1123 : recl= 9608 : max=5000 : def= 500 NOTE: %INCLUDE (level 1) file X is file SASHELP.EMUTIL.EXPLOREOBS.SOURCE. 20474 +/*------------------------------------------------------------------ 20475 + MACRO EXPLOREOBS 20476 + 20477 + SUPPORT: SASDHD - David Duling 20478 + PRODUCT: Enterprise Miner 20479 + 20480 + DESCRIPTION: 20481 + Generates maximum and default numbers of observations to 20482 + download for visualization depending on the record length. 20483 + 20484 + Values were determined by trial and error using typical 20485 + Windows workstation configurations. 20486 + 20487 + Discrete sets of values are returned so that user experience 20488 + will be consitent with similar sized data sets. 20489 + 20490 + These macro variables are set: 20491 + _exploreobs_max -- maximum number of obs downloadable 20492 + _exploreobs_def -- default number of obs to be downloaded 20493 + _exploreobs_recl - record length. Might be useful for reporting. 20494 + 20495 + Use the _exploreobs_max to set limit the GUI selection of 20496 + observations for downloading. The GUI selection for obs 20497 + could be reduced to "Default" and "Max". 20498 + 20499 + Parameters 20500 + data= libname.memname of input data 20501 + vars= subset list of variables. 20502 + downloading 1 out of 500 really does work like downloading 20503 + 1 out of 1 vars. Users may select a subset of vars for 20504 + visualizations. Pass in the list as space delimited 20505 + var names. If vars is not specified, the record length 20506 + of the entire data will be used. 20507 + NBYTES= maximum number of bytes that shouldn't be exceeded. 20508 + 20509 + Control 20510 + Users may control the values by entering these macro variables. 20511 + EM_EXPLOREOBS_MAX 20512 + EM_EXPLOREOBS_DEFAULT 20513 + These values override the computed values. 20514 + 20515 + Debugging 20516 + %let _exploreobs_debug=1 ; 20517 +-------------------------------------------------------------------- 20518 + HISTORY: 20APR2004. sasdhd. pushed. 20519 + 18DEC2004. sasdhd. S0280556. 20520 + 07SEP2007. sasdhd. HK1009586 20521 +--------------------------------------------------------------------*/ 20522 + 20523 +%macro exploreobs(data=,vars=, nbytes=) ; 20524 + 20525 + /*--- variable definitions ---*/ 20526 + %global _exploreobs_max _exploreobs_def _exploreobs_recl _exploreobs_debug ; 20527 + %local xobs xvars xlen vlen xi vname vlist ; 20528 + %local _exp_source _exp_notes ; 20529 + 20530 + /*--- USER definitions ---*/ 20531 + %global EM_EXPLOREOBS_MAX EM_EXPLOREOBS_DEFAULT ; 20532 + 20533 + /*--- variable intializations ---*/ 20534 + %let _exploreobs_max=0 ; 20535 + %let _exploreobs_def=0 ; 20536 + %let _exploreobs_recl=0 ; 20537 + %let xvars= 0 ; 20538 + %let xlen = 0 ; 20539 + %let xobs = 0 ; 20540 + 20541 + /*--- data error checks ---*/ 20542 + %if "&data" eq "" %then %do ; 20543 + %put NOTE: DATA is not specified. ; 20544 + %goto term ; 20545 + %end ; 20546 + 20547 + %let dsid=%sysfunc(open(&data)) ; 20548 + %if not &dsid %then %do ; 20549 + %put NOTE: DATA &data is not available. ; 20550 + %goto term ; 20551 + %end ; 20552 + 20553 + /*--- if a vars list exists generate a subset ---*/ 20554 + %if &vars ne %then %do ; 20555 + %let dsid=%sysfunc(close(&dsid)) ; 20556 + %if &_exploreobs_debug ne 1 %then %do ; 20557 + %let _exp_source=%sysfunc(getoption(SOURCE)) ; 20558 + %let _exp_notes =%sysfunc(getoption(NOTES)) ; 20559 + options nosource nonotes ; 20560 + %end ; 20561 + data _exploreobs_temp_data ; 20562 + set &data(obs=0) ; 20563 + keep &vars ; 20564 + run; 20565 + %if &_exploreobs_debug ne 1 %then %do ; 20566 + options &_exp_source &_exp_notes ; 20567 + %end ; 20568 + %let dsid=%sysfunc(open(_exploreobs_temp_data)) ; 20569 + %if &dsid eq 0 %then %do ; 20570 + %put NOTE: Sample is not available.; 20571 + %goto term ; 20572 + %end ; 20573 + %end ; 20574 + 20575 + /*--- get var attributes ---*/ 20576 + %let xvars=%sysfunc(attrn(&dsid,nvars)) ; 20577 + %let xobs= %sysfunc(attrn(&dsid,nobs )) ; 20578 + %let xlen= %sysfunc(attrn(&dsid,lrecl)) ; 20579 + %let dsid= %sysfunc(close(&dsid)) ; 20580 + 20581 + /*--- set default and max obs ---*/ 20582 + %let _exploreobs_recl=%eval(&xlen) ; 20583 + %if &_exploreobs_recl eq 0 %then %do ; 20584 + %let _exploreobs_max= 0 ; 20585 + %let _exploreobs_def= 0 ; 20586 + %goto term ; 20587 + 20588 + %end ; 20589 + %else 20590 + %if &_exploreobs_recl le 32 %then %do ; 20591 + %let _exploreobs_max=100000 ; 20592 + %let _exploreobs_def= 10000 ; 20593 + %end ; 20594 + %else 20595 + %if &_exploreobs_recl le 128 %then %do ; 20596 + %let _exploreobs_max=60000 ; 20597 + %let _exploreobs_def= 6000 ; 20598 + %end ; 20599 + %else 20600 + %if &_exploreobs_recl lt 1000 %then %do ; 20601 + %let _exploreobs_max=20000 ; 20602 + %let _exploreobs_def= 2000 ; 20603 + %end ; 20604 + %else 20605 + %if &_exploreobs_recl lt 5000 %then %do ; 20606 + %let _exploreobs_max= 10000 ; 20607 + %let _exploreobs_def= 1000 ; 20608 + %end ; 20609 + %else 20610 + %if &_exploreobs_recl lt 20000 %then %do ; 20611 + %let _exploreobs_max= 5000 ; 20612 + %let _exploreobs_def= 500 ; 20613 + %end ; 20614 + %else %do ; 20615 + %let _exploreobs_max= 1000 ; 20616 + %let _exploreobs_def= 200 ; 20617 + %end ; 20618 + 20619 + /*--- Users options ---*/ 20620 + %if &EM_EXPLOREOBS_MAX ne %then %do ; 20621 + %let _exploreobs_max= %eval(&EM_EXPLOREOBS_MAX) ; 20622 + %end; 20623 + %if &EM_EXPLOREOBS_DEFAULT ne %then %do ; 20624 + %let _exploreobs_def= %eval(&EM_EXPLOREOBS_DEFAULT) ; 20625 + %end; 20626 + 20627 + /*--- S0868273 ---*/ 20628 + %if "&NBYTES" ne "" %then %do; 20629 + %let nbytes_nrows = %eval(&nbytes/ &_exploreobs_recl); 20630 + %if &EM_EXPLOREOBS_MAX ne %then %do ; 20631 + %let _exploreobs_max = %sysfunc(min(&nbytes_nrows , &EM_EXPLOREOBS_MAX)); 20632 + %end; 20633 + 20634 + %if &EM_EXPLOREOBS_DEFAULT ne %then %do ; 20635 + %let nbytes_nrows = %eval(&nbytes_nrows/10); 20636 + %let _exploreobs_def = %sysfunc(min(&nbytes_nrows , &EM_EXPLOREOBS_DEFAULT)); 20637 + %if ^&_exploreobs_def %then 20638 + %let _exploreobs_def = 1; 20639 + 20640 + %end; 20641 + %end; 20642 + 20643 + /*--- Terminate ---*/ 20644 + %term: 20645 + 20646 + %put NOTE: EXPLOREOBS &data : vars= &xvars : recl= &_exploreobs_recl : 20646!+max=&_exploreobs_max : def= &_exploreobs_def ; 20647 +%mend ; 20648 + 20649 + NOTE: %INCLUDE (level 1) ending. NOTE: Fileref X has been deassigned. PERFORMANCE DETAILS NOTE: There were 1 observations read from the data set EMWS5.HPDMFOREST_CMETA_TRAIN. WHERE ROLE in ('SEGMENT', 'TARGET') and (LEVEL not = 'INTERVAL'); NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.00 seconds *------------------------------------------------------------* * Simple random sample *------------------------------------------------------------* NOTE: There were 10052 observations read from the data set EMWS5.HPDMFOREST_TRAIN. NOTE: The data set WORK.HPDMFOREST_TRAINSAMPLE has 5000 observations and 1123 variables. NOTE: DATA statement used (Total process time): real time 1.90 seconds cpu time 0.12 seconds NOTE: There were 291 observations read from the data set EMWS5.REPORT_TEMPMETA. WHERE LEVEL in ('BINARY', 'NOMINAL') and (UPCASE(name) not = 'I_EXPLODE'); NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds NOTE: There were 1 observations read from the data set EMWS5.REPORT_TEMPMETA. WHERE (LEVEL='ORDINAL') and (UPCASE(name) not = 'I_EXPLODE'); NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 801 observations read from the data set EMWS5.REPORT_TEMPMETA. WHERE (LEVEL='INTERVAL') and (UPCASE(name) not = 'I_EXPLODE'); NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds ERROR: Variable ULTIMATE_LITIGATION not found. ERROR: Variable ULTIMATE_RTW not found. WARNING: INPUT statement ignored. Type RUN; to continue running the procedure or QUIT; to stop. WARNING: INPUT statement ignored. Type RUN; to continue running the procedure or QUIT; to stop. WARNING: TARGET statement ignored. Type RUN; to continue running the procedure or QUIT; to stop. WARNING: SAVE statement ignored. Type RUN; to continue running the procedure or QUIT; to stop. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.IMPORTANCE may be incomplete. When this step was stopped there were 0 observations and 0 variables. WARNING: The data set WORK.RULES may be incomplete. When this step was stopped there were 0 observations and 0 variables. NOTE: PROCEDURE ARBOR used (Total process time): real time 0.24 seconds cpu time 0.23 seconds NOTE: Variable STAT is uninitialized. NOTE: Variable Character_value is uninitialized. NOTE: Variable Numeric_value is uninitialized. ERROR: BY variable rank is not on input data set WORK.RULES. ERROR: Variable rank is not on file EMWS5.REPORT_VARRANK. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set EMWS5.REPORT_VARRANK may be incomplete. When this step was stopped there were 0 observations and 2 variables. WARNING: Data set EMWS5.REPORT_VARRANK was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.01 seconds NOTE: There were 0 observations read from the data set EMWS5.REPORT_VARRANK. NOTE: The data set EMWS5.REPORT_VARRANK has 0 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.05 seconds cpu time 0.01 seconds WARNING: Variable LABEL already exists on file WORK.TEMPCLASS. NOTE: Table WORK.TEMPCLASS created, with 0 rows and 23 columns. WARNING: Variable LABEL already exists on file WORK.TEMPINTERVAL. NOTE: Table WORK.TEMPINTERVAL created, with 0 rows and 23 columns. NOTE: PROCEDURE SQL used (Total process time): real time 0.03 seconds cpu time 0.04 seconds NOTE: There were 0 observations read from the data set WORK.TEMPCLASS. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 1115 observations read from the data set EMWS5.IDS3_VARIABLESET. NOTE: The data set WORK.TEMPLABEL has 1115 observations and 2 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.01 seconds cpu time 0.00 seconds NOTE: Input data set is empty. NOTE: The data set EMWS5.REPORT_VARRANK has 0 observations and 4 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.02 seconds cpu time 0.00 seconds WARNING: Multiple lengths were specified for the BY variable variable by input data sets. This might cause unexpected results. NOTE: There were 0 observations read from the data set EMWS5.REPORT_VARRANK. NOTE: There were 1115 observations read from the data set WORK.TEMPLABEL. NOTE: The data set EMWS5.REPORT_VARRANK has 0 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.00 seconds NOTE: Input data set is empty. NOTE: The data set EMWS5.REPORT_VARRANK has 0 observations and 4 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.02 seconds cpu time 0.01 seconds NOTE: STATGRAPH 'Rules' has been saved to: WORK.TEMPLAT NOTE: PROCEDURE TEMPLATE used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 0 observations read from the data set. NOTE: PROCEDURE SGRENDER used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 40 observations read from the data set EMWS5.HPDMFOREST_EMRANK. NOTE: The data set EMWS5.REPORT_LIFT has 40 observations and 35 variables. NOTE: DATA statement used (Total process time): real time 0.04 seconds cpu time 0.01 seconds NOTE: STATGRAPH 'Liftplot' has been saved to: WORK.TEMPLAT NOTE: PROCEDURE TEMPLATE used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 40 observations read from the data set EMWS5.REPORT_LIFT. WHERE target='EXPLODE'; NOTE: PROCEDURE SGRENDER used (Total process time): real time 2.51 seconds cpu time 0.18 seconds NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 1268:75 1271:126 NOTE: There were 40 observations read from the data set EMWS5.HPDMFOREST_EMRANK. NOTE: The data set EMWS5.REPORT_CAPRESPONSE has 40 observations and 45 variables. NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.01 seconds NOTE: STATGRAPH 'Reg_emrank' has been saved to: WORK.TEMPLAT NOTE: PROCEDURE TEMPLATE used (Total process time): real time 0.01 seconds cpu time 0.01 seconds NOTE: There were 20 observations read from the data set EMWS5.REPORT_CAPRESPONSE. WHERE datarole='VALIDATE'; NOTE: The data set WORK.TEMPVALID has 20 observations and 45 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: WHERE clause has been augmented. NOTE: There were 20 observations read from the data set EMWS5.REPORT_CAPRESPONSE. WHERE (target='EXPLODE') and (datarole='VALIDATE'); NOTE: PROCEDURE SGRENDER used (Total process time): real time 0.35 seconds cpu time 0.09 seconds NOTE: PROCEDURE SQL used (Total process time): real time 0.01 seconds cpu time 0.00 seconds NOTE: There were 117 observations read from the data set EMWS5.MDLCOMP_EMROC. WHERE ((STRIP(model)='_Baseline_') and (DataRole='TRAIN')) or ((STRIP(model)='HPDMForest') and DataRole in ('TRAIN', 'VALIDATE')); NOTE: The data set EMWS5.REPORT_ROC has 117 observations and 20 variables. NOTE: DATA statement used (Total process time): real time 0.04 seconds cpu time 0.01 seconds NOTE: Table WORK.KS_STAT created, with 2 rows and 2 columns. NOTE: PROCEDURE SQL used (Total process time): real time 0.02 seconds cpu time 0.00 seconds NOTE: The data set WORK.REFLINE has 6 observations and 7 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 117 observations read from the data set EMWS5.REPORT_ROC. NOTE: There were 6 observations read from the data set WORK.REFLINE. NOTE: The data set EMWS5.REPORT_ROC has 123 observations and 23 variables. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.01 seconds NOTE: STATGRAPH 'Rocplot' has been saved to: WORK.TEMPLAT NOTE: PROCEDURE TEMPLATE used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: There were 123 observations read from the data set EMWS5.REPORT_ROC. NOTE: The data set EMWS5.REPORT_ROC has 123 observations and 23 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.03 seconds cpu time 0.00 seconds NOTE: There were 123 observations read from the data set EMWS5.REPORT_ROC. NOTE: PROCEDURE SGRENDER used (Total process time): real time 1.00 seconds cpu time 0.18 seconds NOTE: There were 6 observations read from the data set EMWS5.HPDMFOREST_EMCLASSIFICATION. WHERE (_TYPE_='PREDICTION') and (TARGET='EXPLODE'); NOTE: The data set EMWS5.REPORT_MISCLASS has 6 observations and 12 variables. NOTE: DATA statement used (Total process time): real time 0.04 seconds cpu time 0.03 seconds NOTE: There were 6 observations read from the data set EMWS5.REPORT_MISCLASS. NOTE: PROCEDURE TABULATE used (Total process time): real time 0.02 seconds cpu time 0.01 seconds NOTE: There were 69 observations read from the data set EMWS5.MDLCOMP_EMREPORTFIT. NOTE: The data set EMWS5.REPORT_REPORTFIT has 69 observations and 9 variables. NOTE: DATA statement used (Total process time): real time 0.08 seconds cpu time 0.06 seconds NOTE: WHERE clause has been augmented. NOTE: There were 14 observations read from the data set EMWS5.REPORT_REPORTFIT. WHERE (MODEL='HPDMForest') and FitStat in ('KS', '_AIC_', '_ALOSS_', '_ASE_', '_AUR_', '_AVERR_', '_CAPC_', '_CAP_', '_GINI_', '_KS_PROB_CUTOFF', '_LIFTC_', '_LIFT_', '_LOSS_', '_MAX_', '_MISC_', '_MSE_', '_NOBS_', '_RASE_', '_RMSE_', '_SBC_', '_SSE_') and (TARGET='EXPLODE') and (TRAIN not = .); NOTE: PROCEDURE PRINT used (Total process time): real time 0.02 seconds cpu time 0.03 seconds 20650 data work.modelprop; 20651 length SOURCE $12 NAME $64 TYPE $1 VALUE $200; 20652 SOURCE="PROPERTIES"; 20653 NAME="NumberOfReportedLevels"; 20654 VALUE="1E-6"; 20655 TYPE="N"; 20656 output; 20657 SOURCE="PROPERTIES"; 20658 NAME="NormalizeReportingVariables"; 20659 VALUE="Y"; 20660 TYPE="C"; 20661 output; 20662 SOURCE="PROPERTIES"; 20663 NAME="DecileBin"; 20664 VALUE="20"; 20665 TYPE="N"; 20666 output; 20667 SOURCE="PROPERTIES"; 20668 NAME="LiftEpsilon"; 20669 VALUE="1E-6"; 20670 TYPE="N"; 20671 output; 20672 SOURCE="PROPERTIES"; 20673 NAME="ProfitEpsilon"; 20674 VALUE="1E-6"; 20675 TYPE="N"; 20676 output; 20677 SOURCE="PROPERTIES"; 20678 NAME="RoiEpsilon"; 20679 VALUE="1E-6"; 20680 TYPE="N"; 20681 output; 20682 SOURCE="PROPERTIES"; 20683 NAME="ScoreDistBin"; 20684 VALUE="20"; 20685 TYPE="N"; 20686 output; 20687 SOURCE="PROPERTIES"; 20688 NAME="RocChart"; 20689 VALUE="Y"; 20690 TYPE="C"; 20691 output; 20692 SOURCE="PROPERTIES"; 20693 NAME="RocEpsilon"; 20694 VALUE="0.01"; 20695 TYPE="N"; 20696 output; 20697 SOURCE="PROPERTIES"; 20698 NAME="AssessAllTargetLevels"; 20699 VALUE="N"; 20700 TYPE="C"; 20701 output; 20702 SOURCE="PROPERTIES"; 20703 NAME="SelectionData"; 20704 VALUE="DEFAULT"; 20705 TYPE="C"; 20706 output; 20707 SOURCE="PROPERTIES"; 20708 NAME="HPCriteria"; 20709 VALUE="DEFAULT"; 20710 TYPE="C"; 20711 output; 20712 SOURCE="PROPERTIES"; 20713 NAME="SelectionTable"; 20714 VALUE="TRAIN"; 20715 TYPE="C"; 20716 output; 20717 SOURCE="PROPERTIES"; 20718 NAME="SelectionCriteria"; 20719 VALUE="DEFAULT"; 20720 TYPE="C"; 20721 output; 20722 SOURCE="PROPERTIES"; 20723 NAME="SelectionDepth"; 20724 VALUE="10"; 20725 TYPE="C"; 20726 output; 20727 SOURCE="PROPERTIES"; 20728 NAME="NumberofBins"; 20729 VALUE="20"; 20730 TYPE="N"; 20731 output; 20732 SOURCE="PROPERTIES"; 20733 NAME="RecomputeAssess"; 20734 VALUE="N"; 20735 TYPE="C"; 20736 output; 20737 SOURCE="PROPERTIES"; 20738 NAME="TargetName"; 20739 VALUE="EXPLODE"; 20740 TYPE="C"; 20741 output; 20742 SOURCE="PROPERTIES"; 20743 NAME="ModelId"; 20744 VALUE="HPDMForest"; 20745 TYPE="C"; 20746 output; 20747 SOURCE="PROPERTIES"; 20748 NAME="ModelDescription"; 20749 VALUE="HP Forest"; 20750 TYPE="C"; 20751 output; 20752 SOURCE="PROPERTIES"; 20753 NAME="ModelCriteria"; 20754 VALUE="Valid: Misclassification Rate"; 20755 TYPE="C"; 20756 output; 20757 SOURCE="PROPERTIES"; 20758 NAME="ForceRun"; 20759 VALUE="N"; 20760 TYPE="C"; 20761 output; 20762 SOURCE="PROPERTIES"; 20763 NAME="RunAction"; 20764 VALUE="Train"; 20765 TYPE="C"; 20766 output; 20767 SOURCE="PROPERTIES"; 20768 NAME="VariableProperties"; 20769 VALUE=""; 20770 TYPE=""; 20771 output; 20772 SOURCE="PROPERTIES"; 20773 NAME="FileProperties"; 20774 VALUE=""; 20775 TYPE=""; 20776 output; 20777 SOURCE="PROPERTIES"; 20778 NAME="Component"; 20779 VALUE="ModelCompare"; 20780 TYPE="C"; 20781 output; 20782 SOURCE="PROPERTIES"; 20783 NAME="RawCreateTime"; 20784 VALUE="1757498001.3"; 20785 TYPE="C"; 20786 output; 20787 SOURCE="PROPERTIES"; 20788 NAME="CreateTime"; 20789 VALUE="10SEP2015:09:53:21"; 20790 TYPE="C"; 20791 output; 20792 SOURCE="PROPERTIES"; 20793 NAME="RunId"; 20794 VALUE="4eeb4be2-d66d-4ca3-856d-f14e6b11ebc8"; 20795 TYPE="C"; 20796 output; 20797 SOURCE="PROPERTIES"; 20798 NAME="StatisticUsed"; 20799 VALUE="_VMISC_"; 20800 TYPE="C"; 20801 output; 20802 SOURCE="PROPERTIES"; 20803 NAME="TargetLabel"; 20804 VALUE=""; 20805 TYPE="C"; 20806 output; 20807 SOURCE="COMMON"; 20808 NAME="COLUMNSMETADATASOURCE"; 20809 VALUE="HPDMForest_TRAIN"; 20810 TYPE="C"; 20811 output; 20812 SOURCE="COMMON"; 20813 NAME="HPDM"; 20814 VALUE="N"; 20815 TYPE="C"; 20816 output; 20817 SOURCE="COMMON"; 20818 NAME="USERTOOL"; 20819 VALUE="0"; 20820 TYPE="N"; 20821 output; 20822 SOURCE="COMMON"; 20823 NAME="TOOLTYPE"; 20824 VALUE="ASSESS"; 20825 TYPE="C"; 20826 output; 20827 SOURCE="COMMON"; 20828 NAME="TOOLPREFIX"; 20829 VALUE="MdlComp"; 20830 TYPE="C"; 20831 output; 20832 SOURCE="COMMON"; 20833 NAME="VERSION"; 20834 VALUE="13.1"; 20835 TYPE="N"; 20836 output; 20837 SOURCE="COMMON"; 20838 NAME="COMPONENT"; 20839 VALUE="ModelCompare"; 20840 TYPE="C"; 20841 output; 20842 SOURCE="COMMON"; 20843 NAME="DESCRIPTION"; 20844 VALUE="Model Compare Class"; 20845 TYPE="C"; 20846 output; 20847 SOURCE="COMMON"; 20848 NAME="METAPORT"; 20849 VALUE=""; 20850 TYPE="C"; 20851 output; 20852 SOURCE="COMMON"; 20853 NAME="ACCUMULATEDSCORECODE"; 20854 VALUE="N"; 20855 TYPE="C"; 20856 output; 20857 SOURCE="COMMON"; 20858 NAME="FLOWSCORECODEFORMAT"; 20859 VALUE="DATASTEP"; 20860 TYPE="C"; 20861 output; 20862 SOURCE="COMMON"; 20863 NAME="PUBLISHSCORECODEFORMAT"; 20864 VALUE="DATASTEP"; 20865 TYPE="C"; 20866 output; 20867 SOURCE="COMMON"; 20868 NAME="FLOWSCORECODE"; 20869 VALUE="EMFLOWSCORECODE"; 20870 TYPE="C"; 20871 output; 20872 SOURCE="COMMON"; 20873 NAME="PUBLISHSCORECODE"; 20874 VALUE="EMFLOWSCORECODE"; 20875 TYPE="C"; 20876 output; 20877 SOURCE="COMMON"; 20878 NAME="MININGFUNCTION"; 20879 VALUE="None"; 20880 TYPE="C"; 20881 output; 20882 SOURCE="COMMON"; 20883 NAME="MINIMUMPARENTS"; 20884 VALUE="1"; 20885 TYPE="N"; 20886 output; 20887 SOURCE="COMMON"; 20888 NAME="ADJUSTPOSTERIOR"; 20889 VALUE="Y"; 20890 TYPE="C"; 20891 output; 20892 SOURCE="COMMON"; 20893 NAME="DECISIONINFO"; 20894 VALUE="N"; 20895 TYPE="C"; 20896 output; 20897 SOURCE="COMMON"; 20898 NAME="CLASS"; 20899 VALUE="SASHELP.EMASSMT.ASSESS"; 20900 TYPE="C"; 20901 output; 20902 SOURCE="COMMON"; 20903 NAME="METASOURCE_NODELABEL"; 20904 VALUE="HPDMForest"; 20905 TYPE="C"; 20906 output; 20907 SOURCE="COMMON"; 20908 NAME="METASOURCE_NODEPORT"; 20909 VALUE="TRAIN"; 20910 TYPE="C"; 20911 output; 20912 SOURCE="COMMON"; 20913 NAME="METASOURCE_DATA"; 20914 VALUE="EMWS5.HPDMForest_TRAIN"; 20915 TYPE="C"; 20916 output; 20917 SOURCE="COMMON"; 20918 NAME="METASOURCE_METADATA"; 20919 VALUE="EMWS5.HPDMForest_CMeta_TRAIN"; 20920 TYPE="C"; 20921 output; 20922 run; NOTE: The data set WORK.MODELPROP has 54 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: There were 1 observations read from the data set WORK.MODELPROP. WHERE NAME='ModelCriteria'; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds WARNING: The variable _AIC_ in the DROP, KEEP, or RENAME list has never been referenced. NOTE: There were 3 observations read from the data set EMWS5.MDLCOMP_EMOUTFIT. NOTE: The data set EMWS5.REPORT_COMPAREMDL has 3 observations and 6 variables. NOTE: DATA statement used (Total process time): real time 0.04 seconds cpu time 0.00 seconds NOTE: There were 3 observations read from the data set EMWS5.REPORT_COMPAREMDL. NOTE: PROCEDURE PRINT used (Total process time): real time 0.01 seconds cpu time 0.01 seconds NOTE: The data set EMWS5.REPORT_PROJINFO has 4 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.03 seconds NOTE: There were 4 observations read from the data set EMWS5.REPORT_PROJINFO. NOTE: PROCEDURE PRINT used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: 1 lines were written to file PRINT. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: ODS PDF printed 3 pages to \\kramer\sas\SFM_SAS\PredictiveModeling\PredictiveModelingCPM\CPM_EM\CPM_Trees\Workspaces\E MWS5\Report\REPORT.pdf. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: 11 lines were written to file PRINT. NOTE: The DATA step printed page 2. NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.01 seconds NOTE: The data set WORK.EM_USER_REPORT has 132 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.07 seconds cpu time 0.07 seconds 20923 *------------------------------------------------------------*; 20924 * End TRAIN: Report; 20925 *------------------------------------------------------------*; 20926 *------------------------------------------------------------* * * ERROR: Run time error was encountered. The system error returned was 3000. * Please report unresolved problems to Technical Support. * *------------------------------------------------------------*