[R] Inefficiency of SAS Programming
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Fri Feb 27 14:53:41 CET 2009
Ajay ohri wrote:
> Sometimes for the sake of simplicity, SAS coding is created like that.
> One can use the concatenate function and drag and drop in an simple
> excel sheet for creating elaborate SAS code like the one mentioned and
> without any time at all.
A system that requires Excel for its success is not a complete system.
> There are multiple ways to do this in SAS , much better and similarly in
> There are many areas that SAS programmers would find R a bit not so
> useful ---example
> the equivalence of proc logistic for creating a logistic model.
Really? Try this in SAS:
f <- lrm(death ~ rcs(age,5)*sex)
anova(f) # get test of nonlinearity of interactions among other things
nomogram(f) # depict model graphically
The restricted cubic spline in age, i.e., assuming the age relationship
is smooth but not much else, is very easy to code in R. There are many
other automatic transformations available. The lack of generality of
the SAS language makes many SAS users assume linearity for more often
than R users do.
Also note that PROC LOGISTIC, without invocation of a special option,
would make the user believe that older subjects have lower chances of
dying, as SAS by default takes the even being predicted to be death=0.
> On Fri, Feb 27, 2009 at 10:21 AM, Wensui Liu <liuwensui at gmail.com
> <mailto:liuwensui at gmail.com>> wrote:
> Thanks for pointing me to the SAS code, Dr Harrell
> After reading codes, I have to say that the inefficiency is not
> related to SAS language itself but the SAS programmer. An experienced
> SAS programmer won't use much of hard-coding, very adhoc and difficult
> to maintain.
> I agree with you that in the SAS code, it is a little too much to
> evaluate predictions. such complex data step actually can be replaced
> by simpler iml code.
> On Thu, Feb 26, 2009 at 5:57 PM, Frank E Harrell Jr
> <f.harrell at vanderbilt.edu <mailto:f.harrell at vanderbilt.edu>> wrote:
> > 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
> > regression model. I estimate that using R would easily cut the
> > time of this set of programs by a factor of 4.
> > Frank
> > --
> > Frank E Harrell Jr Professor and Chair School of Medicine
> > Department of Biostatistics Vanderbilt
> > ______________________________________________
> > R-help at r-project.org <mailto:R-help at r-project.org> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > and provide commented, minimal, self-contained, reproducible code.
> WenSui Liu
> Acquisition Risk, Chase
> Blog : statcompute.spaces.live.com
> I can calculate the motion of heavenly bodies, but not the madness
> of people.”
> -- Isaac Newton
> R-help at r-project.org <mailto:R-help at r-project.org> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help