things that are difficult/impossible to do in SAS or SPSS but simple in R

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

things that are difficult/impossible to do in SAS or SPSS but simple in R

Matthew Keller
Hi all,

I'm giving a talk in a few days to a group of psychology faculty and
grad students re the R statistical language. Most people in my dept.
use SAS or SPSS. It occurred to me that it would be nice to have a few
concrete examples of things that are fairly straightforward to do in R
but that are difficult or impossible to do in SAS or SPSS. However, it
has been so long since I have used either of those commercial products
that I am drawing a blank. I've searched the forums and web for a list
and came up with just Bob Muenchen's comparison of general procedures
and Patrick Burns' overview of the three. Neither of these give
concrete examples of statistical problems that are easily solved in R
but not the commercial packages.

Can anyone more familiar with SAS or SPSS think of some examples of
problems that they couldn't do in one of those packages but that could
be done easily in R? Similarly, if there are any examples of the
converse I would also be interested to know.

Best,

Matt

--
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS butsimple in R

Doran, Harold
SAS cannot deal with multiple levels of random effects in a generalized
linear mixed model whereas the lmer function can handle multiple levels.
The SAS proc can only deal with 1 level of clustering and it is still
extremely s l o w ..

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Matthew Keller
> Sent: Tuesday, January 15, 2008 2:45 PM
> To: R Help
> Subject: [R] things that are difficult/impossible to do in
> SAS or SPSS butsimple in R
>
> Hi all,
>
> I'm giving a talk in a few days to a group of psychology
> faculty and grad students re the R statistical language. Most
> people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to
> have a few concrete examples of things that are fairly
> straightforward to do in R but that are difficult or
> impossible to do in SAS or SPSS. However, it has been so long
> since I have used either of those commercial products that I
> am drawing a blank. I've searched the forums and web for a
> list and came up with just Bob Muenchen's comparison of
> general procedures and Patrick Burns' overview of the three.
> Neither of these give concrete examples of statistical
> problems that are easily solved in R but not the commercial packages.
>
> Can anyone more familiar with SAS or SPSS think of some
> examples of problems that they couldn't do in one of those
> packages but that could be done easily in R? Similarly, if
> there are any examples of the converse I would also be
> interested to know.
>
> Best,
>
> Matt
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Wensui Liu
In reply to this post by Matthew Keller
Just a part list i am interested that R can but SAS can't.

latent class regression
R     : flexmix package
SAS: none

generalized regression neural nets
R: grnnR
SAS: none

generalized PLS
R: gpls
SAS: none

mars
R: mda
SAS: none


On Jan 15, 2008 2:45 PM, Matthew Keller <[hidden email]> wrote:

> Hi all,
>
> I'm giving a talk in a few days to a group of psychology faculty and
> grad students re the R statistical language. Most people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to have a few
> concrete examples of things that are fairly straightforward to do in R
> but that are difficult or impossible to do in SAS or SPSS. However, it
> has been so long since I have used either of those commercial products
> that I am drawing a blank. I've searched the forums and web for a list
> and came up with just Bob Muenchen's comparison of general procedures
> and Patrick Burns' overview of the three. Neither of these give
> concrete examples of statistical problems that are easily solved in R
> but not the commercial packages.
>
> Can anyone more familiar with SAS or SPSS think of some examples of
> problems that they couldn't do in one of those packages but that could
> be done easily in R? Similarly, if there are any examples of the
> converse I would also be interested to know.
>
> Best,
>
> Matt
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>
> ______________________________________________
> [hidden email] 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.
>



--
===============================
WenSui Liu
Statistical Project Manager
ChoicePoint Precision Marketing
(http://spaces.msn.com/statcompute/blog)

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS butsimple in R

Greg Snow-2
In reply to this post by Matthew Keller
My SAS and SPSS are rusty as well, so things may have changed, but I
think it is still difficult to do simulations and general bootstrap type
analyses (simulate or resample a dataset, analyze it and capture a piece
(or pieces) of the output, repeate many times and end up with a
vector/matrix of interest).

Some aspects of graphics, adding to graphs I believe is still quite a
bit easier in R/S-PLUS.
Show some interactive graphics, start with simple things like the
identify function, up to more complex examples (some in the
TeachingDemos package as well as other places), also look at the iplots
and rgl packages.

I (and I expect others here) am interested in what you find, maybe you
could post a link to your finished presentation after you give it.

Those are the things that come to my mind first, hope it helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[hidden email]
(801) 408-8111
 
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Matthew Keller
> Sent: Tuesday, January 15, 2008 12:45 PM
> To: R Help
> Subject: [R] things that are difficult/impossible to do in
> SAS or SPSS butsimple in R
>
> Hi all,
>
> I'm giving a talk in a few days to a group of psychology
> faculty and grad students re the R statistical language. Most
> people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to
> have a few concrete examples of things that are fairly
> straightforward to do in R but that are difficult or
> impossible to do in SAS or SPSS. However, it has been so long
> since I have used either of those commercial products that I
> am drawing a blank. I've searched the forums and web for a
> list and came up with just Bob Muenchen's comparison of
> general procedures and Patrick Burns' overview of the three.
> Neither of these give concrete examples of statistical
> problems that are easily solved in R but not the commercial packages.
>
> Can anyone more familiar with SAS or SPSS think of some
> examples of problems that they couldn't do in one of those
> packages but that could be done easily in R? Similarly, if
> there are any examples of the converse I would also be
> interested to know.
>
> Best,
>
> Matt
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Roland Rau-3
In reply to this post by Matthew Keller
Hi,

maybe I missed something while using SAS or SPSS. So please make sure
that I am not talking nonsense here.

- How would you re-use results in SPSS or SAS? If it is possible for SAS
and SPSS, I am fairly sure it is not as easy as in R:
lmmodel1 <- lm(Y~X)
myslope <- coef(lmmodel1)[2]
- You have population and death data on the individual level classified
by year, age, sex, and country. Now you want to calculate the
probability of dying by year, age, sex, and country.
In R, i would do:
pop.array <- tapply(X=popdata$Count,
                        INDEX=list(Age=popdata$Age,
                                Year=popdata$Year,
                                Sex=popdata$Sex,
                                Country=popdata$Country),
                        FUN=sum)
dth.array <- tapply(X=dthdata$Count,
                        INDEX=list(Age=dthdata$Age,
                                Year=dthdata$Year,
                                Sex=dthdata$Sex,
                                Country=dthdata$Country),
                        FUN=sum)
prop.dying.array <- dth.array / pop.array

Now you can easily extract a vector of the probability of dying of 85
year-old men dying in the first year of observation in all countries by
writing:
prop.dying.array[86,1,1,]
- I hope I am wrong on this one. But when I was using SPSS, I could not
find any possibility to include left truncated data in survival
analysis. Maybe I did not find this possibility or maybe it has been
included since.
- The function outer()
- Data are not always rectangular data frames.


Those are just a few thoughts which came to my mind.
I hope this helps,
Roland

                               

Matthew Keller wrote:

> Hi all,
>
> I'm giving a talk in a few days to a group of psychology faculty and
> grad students re the R statistical language. Most people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to have a few
> concrete examples of things that are fairly straightforward to do in R
> but that are difficult or impossible to do in SAS or SPSS. However, it
> has been so long since I have used either of those commercial products
> that I am drawing a blank. I've searched the forums and web for a list
> and came up with just Bob Muenchen's comparison of general procedures
> and Patrick Burns' overview of the three. Neither of these give
> concrete examples of statistical problems that are easily solved in R
> but not the commercial packages.
>
> Can anyone more familiar with SAS or SPSS think of some examples of
> problems that they couldn't do in one of those packages but that could
> be done easily in R? Similarly, if there are any examples of the
> converse I would also be interested to know.
>
> Best,
>
> Matt
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Roland Rau-3
In reply to this post by Matthew Keller
Hi Matthew,

something else came to my mind:
why don't you post something similar to the newsgroups:
comp.soft-sys.stat.spss
comp.soft-sys.sas

R-help is obviously biased and maybe there are things "we" (the R
community) are just missing. Maybe there are things possible in SPSS or
SAS which R people are not aware of?

I would be really curious what SPSS or SAS users could give as an
argument why they prefer their software.

All the best,
Roland


Matthew Keller wrote:

> Hi all,
>
> I'm giving a talk in a few days to a group of psychology faculty and
> grad students re the R statistical language. Most people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to have a few
> concrete examples of things that are fairly straightforward to do in R
> but that are difficult or impossible to do in SAS or SPSS. However, it
> has been so long since I have used either of those commercial products
> that I am drawing a blank. I've searched the forums and web for a list
> and came up with just Bob Muenchen's comparison of general procedures
> and Patrick Burns' overview of the three. Neither of these give
> concrete examples of statistical problems that are easily solved in R
> but not the commercial packages.
>
> Can anyone more familiar with SAS or SPSS think of some examples of
> problems that they couldn't do in one of those packages but that could
> be done easily in R? Similarly, if there are any examples of the
> converse I would also be interested to know.
>
> Best,
>
> Matt
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Frank Harrell
In reply to this post by Matthew Keller
Matthew Keller wrote:

> Hi all,
>
> I'm giving a talk in a few days to a group of psychology faculty and
> grad students re the R statistical language. Most people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to have a few
> concrete examples of things that are fairly straightforward to do in R
> but that are difficult or impossible to do in SAS or SPSS. However, it
> has been so long since I have used either of those commercial products
> that I am drawing a blank. I've searched the forums and web for a list
> and came up with just Bob Muenchen's comparison of general procedures
> and Patrick Burns' overview of the three. Neither of these give
> concrete examples of statistical problems that are easily solved in R
> but not the commercial packages.
>
> Can anyone more familiar with SAS or SPSS think of some examples of
> problems that they couldn't do in one of those packages but that could
> be done easily in R? Similarly, if there are any examples of the
> converse I would also be interested to know.
>
> Best,
>
> Matt
>

Here is a simple thing that is easy to do in R or S-Plus but difficult
in SAS or SPSS:

Compute the number of subjects having age below the mean age

sum(age < mean(age))


Here is something not quite so simple that is very difficult to do in
SPSS or SAS.  Show descriptive statistics for every variable in a data
frame that is numeric and has at least 10 unique values.

v <- sapply(mydata, function(x) is.numeric(x) && length(unique(x)) >= 10)
summary(mydata[v])

--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
[hidden email] 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.
Frank Harrell
Department of Biostatistics, Vanderbilt University
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Gabor Grothendieck
On Jan 15, 2008 6:04 PM, Frank E Harrell Jr <[hidden email]> wrote:

> Matthew Keller wrote:
> > Hi all,
> >
> > I'm giving a talk in a few days to a group of psychology faculty and
> > grad students re the R statistical language. Most people in my dept.
> > use SAS or SPSS. It occurred to me that it would be nice to have a few
> > concrete examples of things that are fairly straightforward to do in R
> > but that are difficult or impossible to do in SAS or SPSS. However, it
> > has been so long since I have used either of those commercial products
> > that I am drawing a blank. I've searched the forums and web for a list
> > and came up with just Bob Muenchen's comparison of general procedures
> > and Patrick Burns' overview of the three. Neither of these give
> > concrete examples of statistical problems that are easily solved in R
> > but not the commercial packages.
> >
> > Can anyone more familiar with SAS or SPSS think of some examples of
> > problems that they couldn't do in one of those packages but that could
> > be done easily in R? Similarly, if there are any examples of the
> > converse I would also be interested to know.
> >
> > Best,
> >
> > Matt
> >
>
> Here is a simple thing that is easy to do in R or S-Plus but difficult
> in SAS or SPSS:
>
> Compute the number of subjects having age below the mean age
>
> sum(age < mean(age))
>
>
> Here is something not quite so simple that is very difficult to do in
> SPSS or SAS.  Show descriptive statistics for every variable in a data
> frame that is numeric and has at least 10 unique values.
>
> v <- sapply(mydata, function(x) is.numeric(x) && length(unique(x)) >= 10)
> summary(mydata[v])
>

This can be simplified very slightly (creating mydata[v] directly
rather than creating a vector v and then subscripting with it)
using Filter:

is.ok <- function(x) is.numeric(x) & length(unique(x)) > 10
summary(Filter(is.ok, mydata))

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS butsimple in R

jiho
In reply to this post by Greg Snow-2
On 2008-January-15  , at 21:58 , Greg Snow wrote:
> Some aspects of graphics, adding to graphs I believe is still quite a
> bit easier in R/S-PLUS.


Hadley would give better examples than me (and I'm no expert of SAS-
SPSS) but with ggplots, in R, it is both very easy produce statistical  
plots (i.e. with results from lm's,various smoothers, data density  
etc.) and to overlay different graphics layers without having to take  
care of the scales, legends, etc.
        http://had.co.nz/ggplot2/

NB: the website itself only demonstrates simple graphs done with one  
function (since its purpose is documentation) but overlaying two  
graphs is often as simple as adding them:
p <- ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point()
g <- geom_path(aes(x=wt,y=mpg, colour=qsec))
p + g
(this example is probably useless but it is only for demonstration  
purposes)

JiHO
---
http://jo.irisson.free.fr/

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS butsimple in R

Rolf Turner


How would one do

  > hist(rnorm(300),freq=FALSE,xlim=c(-4,4),main="")
  > curve(dnorm(x),c(-4,4),col="red",add=TRUE)

in SAS or SPSS?  Maybe it's equally easy --- but I doubt it.

                cheers,

                        Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

cberry
In reply to this post by Roland Rau-3
On Tue, 15 Jan 2008, Roland Rau wrote:

> Hi,
>
> maybe I missed something while using SAS or SPSS. So please make sure
> that I am not talking nonsense here.
>
> - How would you re-use results in SPSS or SAS? If it is possible for SAS
> and SPSS, I am fairly sure it is not as easy as in R:
> lmmodel1 <- lm(Y~X)
> myslope <- coef(lmmodel1)[2]

taking off on the 're-use' idea here is a simple, instructive graphic:

  iris.cluster <- hclust( dist( iris[,-5]) )
  plot( iris[,-5], col=cutree( iris.cluster, k=4))

and here we can see if the clustering and choice of 4 clusters was
informative:

   table( iris[,5], cutree( iris.cluster, k=4 ))

Can SAS/SPSS do this easily?

One of the things that makes R/S nice is the existence of sensible methods
for plot, summary, and so on.

Chuck

> - You have population and death data on the individual level classified
> by year, age, sex, and country. Now you want to calculate the
> probability of dying by year, age, sex, and country.
> In R, i would do:
> pop.array <- tapply(X=popdata$Count,
> INDEX=list(Age=popdata$Age,
> Year=popdata$Year,
> Sex=popdata$Sex,
> Country=popdata$Country),
> FUN=sum)
> dth.array <- tapply(X=dthdata$Count,
> INDEX=list(Age=dthdata$Age,
> Year=dthdata$Year,
> Sex=dthdata$Sex,
> Country=dthdata$Country),
> FUN=sum)
> prop.dying.array <- dth.array / pop.array
>
> Now you can easily extract a vector of the probability of dying of 85
> year-old men dying in the first year of observation in all countries by
> writing:
> prop.dying.array[86,1,1,]
> - I hope I am wrong on this one. But when I was using SPSS, I could not
> find any possibility to include left truncated data in survival
> analysis. Maybe I did not find this possibility or maybe it has been
> included since.
> - The function outer()
> - Data are not always rectangular data frames.
>
>
> Those are just a few thoughts which came to my mind.
> I hope this helps,
> Roland
>
>
>
> Matthew Keller wrote:
>> Hi all,
>>
>> I'm giving a talk in a few days to a group of psychology faculty and
>> grad students re the R statistical language. Most people in my dept.
>> use SAS or SPSS. It occurred to me that it would be nice to have a few
>> concrete examples of things that are fairly straightforward to do in R
>> but that are difficult or impossible to do in SAS or SPSS. However, it
>> has been so long since I have used either of those commercial products
>> that I am drawing a blank. I've searched the forums and web for a list
>> and came up with just Bob Muenchen's comparison of general procedures
>> and Patrick Burns' overview of the three. Neither of these give
>> concrete examples of statistical problems that are easily solved in R
>> but not the commercial packages.
>>
>> Can anyone more familiar with SAS or SPSS think of some examples of
>> problems that they couldn't do in one of those packages but that could
>> be done easily in R? Similarly, if there are any examples of the
>> converse I would also be interested to know.
>>
>> Best,
>>
>> Matt
>>
>
> ______________________________________________
> [hidden email] 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:[hidden email]            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Thomas Frööjd
In reply to this post by Matthew Keller
As far as i know mixture modelling (sums of exponentials) cant be done
in SAS or SPSS. For R there is the Rmix package that while not very
user friendly at least works.

On Jan 15, 2008 8:45 PM, Matthew Keller <[hidden email]> wrote:

> Hi all,
>
> I'm giving a talk in a few days to a group of psychology faculty and
> grad students re the R statistical language. Most people in my dept.
> use SAS or SPSS. It occurred to me that it would be nice to have a few
> concrete examples of things that are fairly straightforward to do in R
> but that are difficult or impossible to do in SAS or SPSS. However, it
> has been so long since I have used either of those commercial products
> that I am drawing a blank. I've searched the forums and web for a list
> and came up with just Bob Muenchen's comparison of general procedures
> and Patrick Burns' overview of the three. Neither of these give
> concrete examples of statistical problems that are easily solved in R
> but not the commercial packages.
>
> Can anyone more familiar with SAS or SPSS think of some examples of
> problems that they couldn't do in one of those packages but that could
> be done easily in R? Similarly, if there are any examples of the
> converse I would also be interested to know.
>
> Best,
>
> Matt
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Jeffrey J. Hallman-2
In reply to this post by Matthew Keller
SAS has no facilities for date arithmetic and no easy way to build it
yourself.  In fact, that's the biggest problem with SAS: it stinks as a
programming environment, so it's always much more difficult than it should be
to do something new.  As soon as you get away from the canned procs and have
to write something of your own, SAS falls down.

I don't know enough about SPSS to comment.
--
Jeff

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Daniel Nordlund
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Jeffrey J. Hallman
> Sent: Wednesday, January 16, 2008 2:38 PM
> To: [hidden email]
> Subject: Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in
> R
>
> SAS has no facilities for date arithmetic and no easy way to build it
> yourself.  

This is simply not true.  SAS has all sorts of capabilities for doing arithmetic with dates, times and datetimes, including some very useful formats and functions for computing intervals.  The original poster asked for suggestions of things that were difficult/impossible to do in SAS or SPSS with the goal of getting SAS/SPSS users to consider R.  The only thing he would accomplish by making the above claim to that audience is a loss of credibility.

>In fact, that's the biggest problem with SAS: it stinks as a
> programming environment, so it's always much more difficult than it should be
> to do something new.  As soon as you get away from the canned procs and have
> to write something of your own, SAS falls down.
>
> I don't know enough about SPSS to comment.
> --
> Jeff
>

Dan

Daniel Nordlund
Bothell, WA  USA

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Mxkuhn
Factors have huge benefits over character data in SAS. For a series
regulatory filings, I had miles of SAS code to compute KxK tables
where all the cells must show up. For example, if one of the levels of
one of the variables was never observed, the corresponding row or
column would not show up in proc freq. The basic way around this was
to get all possible combinations of the variables and assign each cell
to have a row count of 0.00000001. Then you would merge this data with
the real counts. The missing row/columns would show up since they had
data, but it was below the printing threshold of proc freq. Hoepfully,
they have added a feature to do this.

You can imagine how much work the test documents were for that macro.
Contrast that with a simple call to the canned table function in R.
And people think that SAS has an advantage when it comes to
"validation"...

Also, I always think about having a real programming language with
namespaces, object-orientation, real functions, scoping, etc. This is
very important and often under-recognized. For example, I've seen SAS
macros called inside of SAS macros; this can be dangerous because the
data lives in the same area and if two macros had a dataset with the
same name the data would be over-written.

--

Max

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSSbut simple in R

robrob
In reply to this post by Jeffrey J. Hallman-2

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

*** Want to know about Britain's birds? Try  www.bto.org/birdfacts ***

Dr Rob Robinson, Senior Population Biologist
British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
Ph: +44 (0)1842 750050         E: [hidden email]
Fx: +44 (0)1842 750030         W: http://www.bto.org

==== "How can anyone be enlightened, when truth is so poorly lit" =====
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Jeffrey J. Hallman
> Sent: 16 January 2008 22:38
> To: [hidden email]
> Subject: Re: [R] things that are difficult/impossible to do
> in SAS or SPSSbut simple in R
>
> SAS has no facilities for date arithmetic and no easy way to
> build it yourself.  In fact, that's the biggest problem with
> SAS: it stinks as a programming environment, so it's always
> much more difficult than it should be to do something new.  
> As soon as you get away from the canned procs and have to
> write something of your own, SAS falls down.
>
> I don't know enough about SPSS to comment.
> --
> Jeff
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSSbut simple in R

Frank Harrell
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.

Frank Harrell

>
> *** Want to know about Britain's birds? Try  www.bto.org/birdfacts ***
>
> Dr Rob Robinson, Senior Population Biologist
> British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
> Ph: +44 (0)1842 750050         E: [hidden email]
> Fx: +44 (0)1842 750030         W: http://www.bto.org
>
> ==== "How can anyone be enlightened, when truth is so poorly lit" =====
>  
>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of Jeffrey J. Hallman
>> Sent: 16 January 2008 22:38
>> To: [hidden email]
>> Subject: Re: [R] things that are difficult/impossible to do
>> in SAS or SPSSbut simple in R
>>
>> SAS has no facilities for date arithmetic and no easy way to
>> build it yourself.  In fact, that's the biggest problem with
>> SAS: it stinks as a programming environment, so it's always
>> much more difficult than it should be to do something new.  
>> As soon as you get away from the canned procs and have to
>> write something of your own, SAS falls down.
>>
>> I don't know enough about SPSS to comment.
>> --
>> Jeff

______________________________________________
[hidden email] 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.
Frank Harrell
Department of Biostatistics, Vanderbilt University
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Peter Dalgaard
In reply to this post by Mxkuhn
Max Kuhn wrote:

> Factors have huge benefits over character data in SAS. For a series
> regulatory filings, I had miles of SAS code to compute KxK tables
> where all the cells must show up. For example, if one of the levels of
> one of the variables was never observed, the corresponding row or
> column would not show up in proc freq. The basic way around this was
> to get all possible combinations of the variables and assign each cell
> to have a row count of 0.00000001. Then you would merge this data with
> the real counts. The missing row/columns would show up since they had
> data, but it was below the printing threshold of proc freq. Hoepfully,
> they have added a feature to do this.
>
>  
I could have sworn that this was a fluke and that it would work if you
put a user-defined format on the classification variable, but no go....
I can't find anything that does this, neither in PROC FREQ nor PROC
TABULATE.



--
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

James Reilly

> Max Kuhn wrote:
>> Factors have huge benefits over character data in SAS. For a series
>> regulatory filings, I had miles of SAS code to compute KxK tables
>> where all the cells must show up. For example, if one of the levels of
>> one of the variables was never observed, the corresponding row or
>> column would not show up in proc freq. The basic way around this was
>> to get all possible combinations of the variables and assign each cell
>> to have a row count of 0.00000001. Then you would merge this data with
>> the real counts. The missing row/columns would show up since they had
>> data, but it was below the printing threshold of proc freq. Hoepfully,
>> they have added a feature to do this.
>>  
On 18/1/08 4:44 AM, Peter Dalgaard wrote:
> I could have sworn that this was a fluke and that it would work if you
> put a user-defined format on the classification variable, but no go....
> I can't find anything that does this, neither in PROC FREQ nor PROC
> TABULATE.

I believe the CLASSDATA option in PROC TABULATE lets you specify which
values will show up in the table, including unobserved values.

http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a002473736.htm#a003069171

I'm not aware of any way to do this in PROC FREQ, though.

--
James Reilly
Department of Statistics, University of Auckland
Private Bag 92019, Auckland, New Zealand

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: things that are difficult/impossible to do in SAS or SPSS but simple in R

Tim Churches
James Reilly wrote:

>> Max Kuhn wrote:
>>> Factors have huge benefits over character data in SAS. For a series
>>> regulatory filings, I had miles of SAS code to compute KxK tables
>>> where all the cells must show up. For example, if one of the levels of
>>> one of the variables was never observed, the corresponding row or
>>> column would not show up in proc freq. The basic way around this was
>>> to get all possible combinations of the variables and assign each cell
>>> to have a row count of 0.00000001. Then you would merge this data with
>>> the real counts. The missing row/columns would show up since they had
>>> data, but it was below the printing threshold of proc freq. Hoepfully,
>>> they have added a feature to do this.
>>>  
> On 18/1/08 4:44 AM, Peter Dalgaard wrote:
>> I could have sworn that this was a fluke and that it would work if you
>> put a user-defined format on the classification variable, but no go....
>> I can't find anything that does this, neither in PROC FREQ nor PROC
>> TABULATE.
>
> I believe the CLASSDATA option in PROC TABULATE lets you specify which
> values will show up in the table, including unobserved values.
>
> http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a002473736.htm#a003069171
>
> I'm not aware of any way to do this in PROC FREQ, though.

You can specify the COMPLETETYPES option in PROC MEANS or PROC SUMMARY
to include output rows for empty cells in a
cross-classification/crosstabulation - but you won't get a nicely
formatted table - you'll have to do that yourself, or wrestle with PROC
TABULATE.

See
http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a000146729.htm -
it is a new feature in Version 9.x of SAS, I think?

Tim C

______________________________________________
[hidden email] 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.
12