This is a SAS code using the macro variable but I am trying to do this in R. Is it possible to use Macro in R?
%macro LOOCV;*Macro Name is LOOCV;
*Take one row out at a time, and there are 295 rows;
%do i = 1 %to 59;
data epilepsy_long_cv;
set epilepsy_long; *Find ith row and set weekly rate to missing, so the model building doesnt use ith observation;
if ID = &i then Weeklyrate=.;
run;
proc Reg Data=epilepsy_long_cv noprint;*Use noprint to suppress output;
model WeeklyRate = Age Time Trt;
output out=work.pred p=predict;
run;
quit;