/*------------------------------------------------------------ Copyright (C) 2000 SAS Institute, Inc. All rights reserved. Notice: The following permissions are granted provided that the above copyright and this notice appear in the code and any related documentation. Permission to copy, modify and distribute the C language source code generated using or distributed with SAS Enterprise Miner C Scoring software and any executables derived from such source code is limited to customers of SAS Institute with a valid license for SAS Enterprise Miner C Scoring software. Any distribution of such executables or source code shall be on an "AS IS" basis without warranty of any kind. SAS and all other SAS Institute. Inc. product and service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. Except as contained in this notice, the name of the SAS Institute, SAS Enterprise Miner and SAS Enterprise Miner C Scoring software shall not be used in the advertising or promotion of products or services without prior written authorization from SAS Institute Inc. ------------------------------------------------------------*/ /*--- start generated code ---*/ #include #include #include #include #include "cscore.h" #include "csparm.h" #define csADIPOSITY indata[0].data.fnum #define csAGE indata[1].data.fnum #define csCHD indata[2].data.fnum #define csFAMHIST indata[3].data.str #define csLDL indata[4].data.fnum #define csOBESITY indata[5].data.fnum #define csSBP indata[6].data.fnum #define csTOBACCO indata[7].data.fnum #define csTYPEA indata[8].data.fnum #define csF_CHD outdata[0].data.str #define csI_CHD outdata[1].data.str #define csP_CHD0 outdata[2].data.fnum #define csP_CHD1 outdata[3].data.fnum #define csR_CHD0 outdata[4].data.fnum #define csR_CHD1 outdata[5].data.fnum #define csU_CHD outdata[6].data.fnum #define cs_LEAF_ outdata[7].data.fnum #define cs_NODE_ outdata[8].data.fnum #define cs_WARN_ outdata[9].data.str SFDKeyWords void score ( PARM *indata, PARM *outdata ) { /*--- Auto Variables ---*/ char cs_ARBFMT_2[13]; char cs_ARBFMT_3[8]; double cs_BRANCH_; double cs_DECNUM; strcpy(cs_WARN_," "); /*--- initialize stand alone formats library ---*/ #if FMTLIB == 1 xfinit(); #endif /*-------------------------------------------------------------**/ /* start_chunk 1458225184.6:t06gglx5 **/ /*-------------------------------------------------------------**/ /* */ /* tool : input data source */ /* type : sampling */ /* node : rclib.satrain [t06gglx5] */ /* */ /*-------------------------------------------------------------**/ /*-------------------------------------------------------------**/ /* end_chunk 1458225184.6:t06gglx5 **/ /*-------------------------------------------------------------**/ /*-------------------------------------------------------------**/ /* start_chunk 1458225533:t1aq1jru **/ /*-------------------------------------------------------------**/ /* */ /* tool : tree */ /* type : model */ /* node : tree [t1aq1jru] */ /* */ /*-------------------------------------------------------------**/ /* */ /* model name : saex */ /* description : */ /* */ /* target : chd */ /*-------------------------------------------------------------**/ /****************************************************************/ /***** decision tree scoring code *******/ /****************************************************************/ /***** lengths of new character variables *******/ /***** labels for new variables *******/ /***** temporary variables for formatted values *******/ strncpyn( cs_ARBFMT_2, 12," "); /* initialize to avoid warning. */ strncpyn( cs_ARBFMT_3, 7," "); /* initialize to avoid warning. */ cs_DECNUM=1; nput( csCHD ,"BEST",12.,0., cs_ARBFMT_2); dmnormcp(cs_ARBFMT_2,32, csF_CHD); /***** assign observation to node *******/ /* using surrogates splits */ cs_BRANCH_ = -1; if (! missingn(csTOBACCO) && csTOBACCO < 7.38) { cs_BRANCH_ = 1; } else if (! missingn(csTOBACCO) && 7.38 <= csTOBACCO) { cs_BRANCH_ = 2; } if ( cs_BRANCH_< 0) { if (! missingn(csLDL) && csLDL < 13.875) { cs_BRANCH_ = 1; } else if (! missingn(csLDL) && 13.875 <= csLDL) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csADIPOSITY) && csADIPOSITY < 42.33) { cs_BRANCH_ = 1; } else if (! missingn(csADIPOSITY) && 42.33 <= csADIPOSITY) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csTYPEA) && csTYPEA < 77.5) { cs_BRANCH_ = 1; } else if (! missingn(csTYPEA) && 77.5 <= csTYPEA) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) cs_BRANCH_ = 1; if ( cs_BRANCH_== 2) { cs_NODE_ = 3; cs_LEAF_ = 7; csP_CHD0 = 0.28888888888888; csP_CHD1 = 0.71111111111111; strncpyn( csI_CHD, 12,"1"); csU_CHD = 1; cs_DECNUM = 2; } else { /* using surrogates splits */ cs_BRANCH_ = -1; cput( csFAMHIST ,"$",7.,0., cs_ARBFMT_3); dmnormip(cs_ARBFMT_3,32); if ( ( streq(cs_ARBFMT_3,"PRESENT") )) { cs_BRANCH_ = 1; } else if ( ( streq(cs_ARBFMT_3,"ABSENT") )) { cs_BRANCH_ = 2; } if ( cs_BRANCH_< 0) { if (! missingn(csSBP) && 145 <= csSBP) { cs_BRANCH_ = 1; } else if (! missingn(csSBP) && csSBP < 145) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csLDL) && 4.655 <= csLDL) { cs_BRANCH_ = 1; } else if (! missingn(csLDL) && csLDL < 4.655) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csTOBACCO) && 3.1 <= csTOBACCO) { cs_BRANCH_ = 1; } else if (! missingn(csTOBACCO) && csTOBACCO < 3.1) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) cs_BRANCH_ = 2; if ( cs_BRANCH_== 1) { /* using surrogates splits */ cs_BRANCH_ = -1; if (! missingn(csADIPOSITY) && csADIPOSITY < 34.575) { cs_BRANCH_ = 1; } else if (! missingn(csADIPOSITY) && 34.575 <= csADIPOSITY) { cs_BRANCH_ = 2; } if ( cs_BRANCH_< 0) { if (! missingn(csOBESITY) && csOBESITY < 31.215) { cs_BRANCH_ = 1; } else if (! missingn(csOBESITY) && 31.215 <= csOBESITY) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) cs_BRANCH_ = 1; if ( cs_BRANCH_== 2) { cs_NODE_ = 9; cs_LEAF_ = 5; csP_CHD0 = 0.15384615384615; csP_CHD1 = 0.84615384615384; strncpyn( csI_CHD, 12,"1"); csU_CHD = 1; cs_DECNUM = 2; } else { /* using surrogates splits */ cs_BRANCH_ = -1; if (! missingn(csLDL) && csLDL < 8.36) { cs_BRANCH_ = 1; } else if (! missingn(csLDL) && 8.36 <= csLDL) { cs_BRANCH_ = 2; } if ( cs_BRANCH_< 0) { if (! missingn(csTYPEA) && csTYPEA < 72.5) { cs_BRANCH_ = 1; } else if (! missingn(csTYPEA) && 72.5 <= csTYPEA) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) cs_BRANCH_ = 1; if ( cs_BRANCH_== 2) { cs_NODE_ = 15; cs_LEAF_ = 4; csP_CHD0 = 0; csP_CHD1 = 1; strncpyn( csI_CHD, 12,"1"); csU_CHD = 1; cs_DECNUM = 2; } else { /* using surrogates splits */ cs_BRANCH_ = -1; if (! missingn(csSBP) && csSBP < 145) { cs_BRANCH_ = 1; } else if (! missingn(csSBP) && 145 <= csSBP) { cs_BRANCH_ = 2; } if ( cs_BRANCH_< 0) { if (! missingn(csADIPOSITY) && csADIPOSITY < 31.74) { cs_BRANCH_ = 1; } else if (! missingn(csADIPOSITY) && 31.74 <= csADIPOSITY) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csTOBACCO) && csTOBACCO < 5.02) { cs_BRANCH_ = 1; } else if (! missingn(csTOBACCO) && 5.02 <= csTOBACCO) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csAGE) && csAGE < 49.5) { cs_BRANCH_ = 1; } else if (! missingn(csAGE) && 49.5 <= csAGE) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) cs_BRANCH_ = 1; if ( cs_BRANCH_== 2) { /* using surrogates splits */ cs_BRANCH_ = -1; if (! missingn(csADIPOSITY) && csADIPOSITY < 32.9) { cs_BRANCH_ = 1; } else if (! missingn(csADIPOSITY) && 32.9 <= csADIPOSITY) { cs_BRANCH_ = 2; } if ( cs_BRANCH_< 0) { if (! missingn(csTOBACCO) && csTOBACCO < 6.62) { cs_BRANCH_ = 1; } else if (! missingn(csTOBACCO) && 6.62 <= csTOBACCO) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csLDL) && csLDL < 7.08) { cs_BRANCH_ = 1; } else if (! missingn(csLDL) && 7.08 <= csLDL) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) { if (! missingn(csOBESITY) && csOBESITY < 26.835) { cs_BRANCH_ = 1; } else if (! missingn(csOBESITY) && 26.835 <= csOBESITY) { cs_BRANCH_ = 2; } } if ( cs_BRANCH_< 0) cs_BRANCH_ = 1; if ( cs_BRANCH_== 2) { cs_NODE_ = 39; cs_LEAF_ = 3; csP_CHD0 = 1; csP_CHD1 = 0; strncpyn( csI_CHD, 12,"0"); csU_CHD = 0; cs_DECNUM = 1; } else { cs_NODE_ = 38; cs_LEAF_ = 2; csP_CHD0 = 0.25; csP_CHD1 = 0.75; strncpyn( csI_CHD, 12,"1"); csU_CHD = 1; cs_DECNUM = 2; } } else { cs_NODE_ = 26; cs_LEAF_ = 1; csP_CHD0 = 0.81081081081081; csP_CHD1 = 0.18918918918918; strncpyn( csI_CHD, 12,"0"); csU_CHD = 0; cs_DECNUM = 1; } } } } else { cs_NODE_ = 5; cs_LEAF_ = 6; csP_CHD0 = 0.82727272727272; csP_CHD1 = 0.17272727272727; strncpyn( csI_CHD, 12,"0"); csU_CHD = 0; cs_DECNUM = 1; } } if (!streq( csF_CHD,"0") && !streq(csF_CHD,"1")) { csR_CHD0 = MISSING; csR_CHD1 = MISSING; } else { csR_CHD0 = -csP_CHD0; csR_CHD1 = -csP_CHD1; { if ( streq(csF_CHD, "0") ) csR_CHD0 = csR_CHD0 +1; else if ( streq(csF_CHD, "1") ) csR_CHD1 = csR_CHD1 +1; } } /****************************************************************/ /***** end of decision tree scoring code *******/ /****************************************************************/ /*-------------------------------------------------------------**/ /* end_chunk 1458225533:t1aq1jru **/ /*-------------------------------------------------------------**/ return; } usrNbucket usrnBuckets[]={ /* not used */ {0,0,0,NULL,NULL,' ',0.0} }; usrCbucket usrcBuckets[]={ /* not used */ {NULL, NULL, 0, NULL} }; usrFormat usrnFormats[] = { {"**unused**",0.0,0,0,0,-1,-1,0} }; usrFormat usrcFormats[] = { {"**unused**",0.0,0,0,0,-1,-1,0} }; int usrNumNfmts = 0; int usrNumCfmts = 0;