Skip to content

Can R replicate this data manipulation in SAS?

1 message · Ista Zahn

#
Hi Paul,
On Fri, Apr 22, 2011 at 10:21 AM, Paul Miller <pjmiller_57 at yahoo.com> wrote:
R is flexible, which is one of the things I like most about it. That
flexibility means you can do almost any given task in more than one
way. This can sometimes lead to the question "which is the best way",
which may be interesting but in my experience is almost always a waste
of time (this statement is ment to apply to data
manipulation/analysis, not nesessarily to package development). Of
course you don't want to make things more complicated than they have
to be, and you of course want to get the right result in the end. But
my view is that when manipulating/analyzing data one should strive for
a "good enough" solution and not worry too much about finding the
"best" one. So while I'm sure someone can improve on my solution, it
works, is relatively easy to follow, and is not overly verbose. Good
enough I say.

I should also note that I don't understand SAS speak at all. I did NOT
translate your SAS code (except for the HARRT part, where a direct
translation seemed like the easies thing to do) -- in fact the first
thing I did was copy your email to a text editor and delete all the
SAS stuff. The way I arrived at the solution was just by looking at
the output you wanted and producing it in R in the way that seemed
most natural to me. Would someone else do it differently? Yes. Could
someone else do it better? Yes. But is it worth the time to try and
find a better way? I doubt it.

Best,
Ista
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org