Example of sas2R

The following SAS code:

DATA test;
INPUT x y f$;
CARDS;
1 2 m
1 3 m
2 4 m
2 4 f
1 5 m
4 3 f
3 2 f
;

PROC PRINT DATA=test;
VAR x;

PROC REG DATA=test;
MODEL y = x;

RUN;

is converted by the sas2R parser to the

library(sastor)
test <- data.frame(x = c(1, 1, 2, 2, 1, 4, 3), y = c(2, 3, 4, 4, 5, 3, 2), f = c("m", "m", "m", "f", "m", "f", "f"))
sas.print.print(test[, c("x"), drop=F])
sas.print.reg(lm(y ~ x, data=test))

which produces the following output when put through R

The SAS2R System

Obs x
1 1
2 1
3 2
4 2
5 1
6 4
7 3

The SAS2R REG Procedure

Analysis of Variance

Dependent Variable: y
Df Sum Sq Mean Sq F value Pr(>F)
Model 1 0.5000 0.5000 0.3608 0.5742
Error 5 6.9286 1.3857
Corrected Total 6 7.4286 1.8857

Root MSE 1.17716 R-Square 0.0673
Dependent Mean 3.28571 Adj R-Sq -0.1192
Coeff Var 35.82672


Parameter Estimates:
DF Estimate Std. Error t value Pr(>|t|)
(Intercept) 1 3.7857 0.9438 4.011 0.0102 *
x 1 -0.2500 0.4162 -0.601 0.5742