[R] Inefficiency of SAS Programming

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Feb 27 00:47:18 CET 2009


2009/2/26 Frank E Harrell Jr <f.harrell at vanderbilt.edu>:
> If anyone wants to see a prime example of how inefficient it is to program
> in SAS, take a look at the SAS programs provided by the US Agency for
> Healthcare Research and Quality for risk adjusting and reporting for
> hospital outcomes at http://www.qualityindicators.ahrq.gov/software.htm .
>  The PSSASP3.SAS program is a prime example.  Look at how you do a vector
> product in the SAS macro language to evaluate predictions from a logistic
> regression model.  I estimate that using R would easily cut the programming
> time of this set of programs by a factor of 4.

 Plenty of examples ripe for sending to www.thedailywtf.com there. Like this:

    IF &N. =  1 THEN SUB_N = 1;
    IF &N. =  3 THEN SUB_N = 2;
    IF &N. =  4 THEN SUB_N = 3;
    IF &N. =  6 THEN SUB_N = 4;
    IF &N. =  7 THEN SUB_N = 5;
    IF &N. =  8 THEN SUB_N = 6;
    IF &N. =  9 THEN SUB_N = 7;
    IF &N. = 10 THEN SUB_N = 8;
    IF &N. = 11 THEN SUB_N = 9;
    IF &N. = 12 THEN SUB_N = 10;
    IF &N. = 13 THEN SUB_N = 11;
    IF &N. = 14 THEN SUB_N = 12;
    IF &N. = 15 THEN SUB_N = 13;
    IF &N. = 17 THEN SUB_N = 14;
    IF &N. = 18 THEN SUB_N = 15;
    IF &N. = 19 THEN SUB_N = 16;

Of course it's possible to write code like that in any language, it
just looks worse when it's in ALL CAPS and written in a style that
looks like the 1980s and onward never happened. The question is
whether it's possible to write this better in SAS. Most of us on this
list could write it in R in a better way.

 Barry




More information about the R-help mailing list