SAS users, welcome to the R world. That page is intended to help you in the switch procedure from SAS to R. You will quickly forget about DATA and PROC steps and discover a whole new world of statistical computing.
Frank Harrell said on R-help on Thu, 2003-09-04 at 08:34:
See (link) Section 1.6 for a comparison of S and SAS (though this doesn’t address numerical reliability). Overall, SAS is about 11 years behind R and S-Plus in statistical capabilities (last year it was about 10 years behind) in my estimation. Frank Harrell SAS User, 1969-1991
Another user comments:
I agree with Frank that R has many advantages over SAS, but an extraordinary exception is in the area of mixed models, where R is literally about 10 years behind SAS (based on the release date of PROC MIXED). PROC MIXED has simple model specification, abundant choice of error structures, enterprise-level data capacity, robust algorithms, convenient tools for reporting general combinations of BLUPs and BLUEs, approximate tests of covariance parameters, multiple options for degrees of freedom in tests of fixed effects, an abundance of example code available on the internet, etc. etc. Not a single one of these features has (traditionally) been available in R. (I know, I have beaten myself blue trying to do these things in R.) Doug Bates and others are doing some great work developing the lme4 package, but SAS is many years ahead in the race. (Genstat too, but that’s another issue.) Use SAS for mixed models. Use R for most everything else.
In this page, Christian Robert describes how to draw random samples from SAS, as an illustration of “Why R and not SAS”; the. Here are the equivalent R commands:
Data2 <- Data[sample(500, 300)]
Sample1 <- test[sample(100, 20, replace = TRUE)]
select <- rnorm(20)
With SAS, one can draw a sample of 20 observations from the exponential distribution as follows :
data test(drop=i);
do i=1 to 20;
x=lambda * ranexp(4145);
output;
end;
run;
4145 is the seed of the generator, more info about SAS seeds. More important here is the fact that lambda is not a parameter of the SAS function ranexp, the SAS user has to figure out((it can be a good exercize though)) that if $$X ~ epsilon(1)$$ then $$\lambda X ~ epsilon(\lambda)$$.
In R, it is much simpler
test <- rexp(20, lambda)
Note that R does not require the seed, but if you want, you can set it using set.seed
— Romain François 2006/03/04 15:49