Updated** I am relatively new to SAS and am having an issue looping through a date variable. At the most basic level, I need to iteratively create multiple data sets (or an iterative concatenation.) I am able to create a static dataset, but am having a problem with looping. Here is the block of code that works
`
%let myvar='11Jul16'd;
data shape_test;
set Analysis_set;
Where(dt_expctd_setmt >&myvar and dt_trd <= &myvar);
by dt_trd;
IF B='.' Then B=0;
IF I='.' Then I=0;
IF S='.' Then S=0;
B=sum(B); I=Sum(I); S=Sum(S);
S_B= S-B;
S_B_I=S-B+I;
format B I S S_B S_B_I dollar12.0;
drop dt_expctd_setmt;
run;`
I would like to loop through a list of dates that would produce the one data set for each date, or stack each date on the previous.
I had something like this in mind, but can not properly access the ith entry in the date vector I am trying to loop through:
%let date_var= the date column;
Do i = 1 to length(%date_var);
%macro PleaseWork(date_var);
Data Project_name&date_var(i);
set Analysis_set;
Where(dt_expctd_setmt >&date_var(i) and dt_trd <= &date_var(i));
Code with all the math stuff (like above)
Run;
%mend
End;
I hope this is clearer! Thank you again for your help!!