[R] Inefficiency of SAS Programming

Frank E Harrell Jr f.harrell at vanderbilt.edu
Fri Feb 27 14:55:32 CET 2009


Gerard M. Keogh wrote:
> Frank,
> 
> I can't see the code you mention - Web marshall at work - but I don't think
> you should be too quick to run down SAS - it's a powerful and flexible
> language but unfortunately very expensive.
> 
> Your example mentions doing a vector product in the macro language - this
> only suggest to me that those people writing the code need a crash course
> in SAS/IML (the matrix language). SAS is designed to work on records and so
> is inapproprorriate for matrices - macros are only an efficient code
> copying device. Doing matrix computations in this way is pretty mad and the
> code would be impossible never mind the memory problems.
> SAS recognise that but a lot of SAS users remain familiar with IML.
> 
> In IML by contrast there are inner, cross and outer products and a raft of
> other useful methods for matrix work that R users would be familiar with.
> OLS for example is one line:
> 
> b = solve(X`X, X`y) ;
> rss = sqrt(ssq(y - Xb)) ;
> 
> And to give you a flavour of IML's capabilities I implemented a SAS version
> of the MARS program in it about 6 or 7 years ago.
> BTW SPSS also has a matrix language.
> 
> Gerard

But try this:

PROC IML;
... some custom user code ...
... loop over j=1 to 10 ...
...   PROC GENMOD, output results back to IML
...

IML is only a partial solution since it is not integrated with the PROC 
step.

Frank

> 
> 
> 
>                                                                            
>              Frank E Harrell                                               
>              Jr                                                            
>              <f.harrell at vander                                          To 
>              bilt.edu>                 R list <r-help at stat.math.ethz.ch>   
>              Sent by:                                                   cc 
>              r-help-bounces at r-                                             
>              project.org                                           Subject 
>                                        [R] Inefficiency of SAS Programming 
>                                                                            
>              26/02/2009 22:57                                              
>                                                                            
>                                                                            
>                                                                            
>                                                                            
> 
> 
> 
> 
> 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.
> 
> Frank
> --
> Frank E Harrell Jr   Professor and Chair           School of Medicine
>                       Department of Biostatistics   Vanderbilt University
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> **********************************************************************************
> The information transmitted is intended only for the p...{{dropped:15}}




More information about the R-help mailing list