[R] things that are difficult/impossible to do in SAS or SPSS but simple in R
Marc Schwartz
marc_schwartz at comcast.net
Fri Jan 18 20:30:47 CET 2008
Jeffrey J. Hallman wrote:
> Frank E Harrell Jr <f.harrell at vanderbilt.edu> writes:
>
>> Rob Robinson wrote:
>>> I wonder if those who complain about SAS as a programming environment have
>>> discovered SAS/IML which provides a programming environment akin to Matlab
>>> which is more than capable (at least for those problems which can be treated
>>> with a matrix like approach). As someone who uses both SAS and R - graphical
>>> output is so much easier in R, but for handling large 'messy' datasets SAS
>>> wins hands down...
>>> Cheers
>>> Rob
>> My understanding is that PROC IML is disconnected from the rest of the
>> SAS language, e.g., you can't have a loop in which PROC GENMOD is called
>> or datasets are merged. If that's the case, IML is not very competitive
>> in my view.
>
> I know about IML, but have never really used it. Back when I was doing that
> kind of stuff (before discovering S-Plus) I used GAUSS for compute-intensive
> matrix simulations and the like. I didn't have SAS for my PC, and there was
> no way I could tie up the Sun boxes at work with simulations for my thesis.
>
> But while IML does some nice stuff, it just reinforces the point I made in
> another post about the proliferation of "little languages" in SAS. By my count,
> that are now 5:
>
> 1. data step programming
> 2. macros -- a 'language' grafted on top of data step programming
> 3. scl -- if you want to do any kind of user interface
> 4. af -- object-oriented framework built on top of scl
> 5. iml -- matrix language like GAUSS, but doesn't play well with 1:4 above.
>
> To be a competent SAS programmer you need to keep 5 different languages
> with 5 different sets of rules in your head while you're coding. I can't do
> this, and I've never met anyone who could. The SAS programmers I've worked
> with all had to consult manuals or example code frequently to figure out how
> to do anything complicated. With R, you just write it.
>
> I've rewritten a number of ugly SAS programs in R. Typically, the R code is a
> third or less the size of the SAS code, although I just did a program a couple
> of days ago in which 112 lines of R replaced two SAS programs totalling 1900
> lines of code, for an 18:1 reduction. Now you could argue that those were
> poorly-written SAS programs, and I would agree. But in my experience, most
> SAS programs are poorly written. SAS provides such poor programming tools
> that most good programmers move on to something else as soon as they can.
>
> Jeff
I think that the phrase "ugly SAS" is a redundancy...
BTW, you have likely heard the old joke about the international
obfuscated programming contest, which was open to all programming languages?
The winner?
A one line SAS macro...
If you want to see some nice examples of obfuscated Perl:
http://www.perlmonks.org/?node=Obfuscated Code
Cheers,
Marc Schwartz
More information about the R-help
mailing list