Más contenido relacionado La actualidad más candente (13) Similar a Adding Statistical Functionality to the DATA Step with PROC FCMP (20) Adding Statistical Functionality to the DATA Step with PROC FCMP10. Linear Approximation Subroutine function linear_approximation (ds_in $, var $, first_obs, last_obs); rc = run_macro(‘linear_approximation_macro’, ds_in, first_obs, last_obs, var, error); return(error); endsub; 12. Recursive Technique: Results data _NULL_; call segment_topdown("sasuser.snp", "work.segds_20", "close", 1, 15116, 0.2); call segment_topdown("sasuser.snp", "work.segds_15", "close", 1, 15116, 0.15); run; 18. Run_Regression Subroutine subroutine run_regression ( data $, dependent $, independent $, weight $, parmData $, parmArray[*]); outargs parmArray; array tmpArray[1] _temporary_; rc = RUN_MACRO ('run_regression_macro', data, parmData , dependent, independent, weight) ; rc = read_array(parmData, tmpArray); do i = 1 to dim(parmArray); parmArray[i] = tmpArray[1,i]; end; endsub; 25. Score Function Macro %macro create_score_func_macro; proc transpose data =¶mds out=¶mds._t; var &independent; run; proc sql noprint; select trim(_NAME_) || " * " || strip(put(col1,BEST12.)) into: theScore separated by " + " from ¶mds._t; select trim(_NAME_) into: theArgs separated by " , " from ¶mds._t; quit; data _NULL_; set ¶mds; call symputX ("Intercept",intercept); run; <continued> 26. Score Function Macro - continued proc fcmp outlib=&library..score; function &scoreFunc(&theArgs); return(&Intercept + &theScore); endsub; quit; %mend create_score_func_macro; 27. Run Create Score Function data _NULL_; call create_score("work.mroz", "lwage", "educ exper age kidslt6 kidsge6", "PredLWage_Full", "sasuser.score"); call create_score("work.mroz", "lwage", "educ exper age", "PredLWage_NoKids", "sasuser.score"); run; data _NULL_; educ = 15; exper = 5; age = 30; kidslt6 = 2; kidsge6 = 1; PredWage_Full = exp(PredLWage_Full(educ, exper, age, kidslt6, kidsge6)); put PredWage_Full=; PredWage_NoKids = exp(PredLWage_NoKids(educ, exper, age)); put PredWage_NoKids=; run; PredWage_Full=3.4199679212 PredWage_NoKids=3.787216653 Notas del editor Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. The SEGMENT_TOPDOWN subroutine was called from the DATA step on S&P 500 data from1950 to 2010. Data contained 15,116 observations Copyright © 2010, SAS Institute Inc. All rights reserved. 42 segments (with 20% error reduction threshold) Copyright © 2010, SAS Institute Inc. All rights reserved. 113 segments (with 15% error reduction threshold) Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Note we ran in fcmp instead of data step Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved. Copyright © 2010, SAS Institute Inc. All rights reserved.