New to IML (just got it, for accessing R). I'd like to run multiple datasets through R, and create multiple datasets from R run.
Using some of the really good posts by Rick Wicklin, I think I'm pretty close, but can't figure out the last step (creating separate datasets for each loop through the do loop). Below is the code I'm using (i dummied a couple datasets for demo purposes)
-- any suggestions would be greatly appreaciated.
Thanks,
Dave
/*Demo Datasetss*/
data in1; retain id g_yr1 g_yr2 ss_yr1 ss_yr2;
do id = 1 to 100;
g_yr1 = 3; g_yr2 = 4; ss_yr1 = rannor(0); ss_yr2 = rannor(0) + .5; output;
end;
run;
data in2; retain id g_yr1 g_yr2 ss_yr1 ss_yr2;
do id = 1 to 100;
g_yr1 = 3; g_yr2 = 4; ss_yr1 = rannor(0); ss_yr2 = rannor(0) + .5; output;
end;
run;
proc IML;
dsnames = "in1":"in2";
outnames = "out1":"out2" ;
outnames = {out1 out2};
do i = 1 to ncol(dsNames);
use (dsNames[i]);
read all into X;
create dt from x;
append from x;
close dt;
run ExportDataSetToR("dt", "dataframe" );
submit /R;
library("SGPdata")
library("SGP")
library("foreign")
sgpData34<- dataframe
g5_sgp34 <- studentGrowthPercentiles(panel.data = sgpData34, sgp.labels=list(my.year =2014, my.subject="MATH"),
num.prior = 1, grade.progression =3:4)
exp <- g5_sgp34$SGPercentiles$MATH.2014
endsubmit;
call ImportDataSetFromR("R_exp", "exp");
use R_exp;
read all into x1;
create outx from x1;
append from x1;
close outx;
close R_exp;
/* here is where I'd like to "create" dataset out1 and out2 (based on the value of i), from the dataset R_exp*??*//
close (dsNames[i]);
end;
quit;