Hello Michael,
Glad you have found this article useful!
It sounds like you are struggling with the fact that the example from the article generates “Animated_Date” values for ALL dates from the start to end dates in the original dataset.
Another way to do this would be to create a comma separated character list of only the dates that exist in the original “Fourth_of_July_Sale” dataset, then feed that list into the do loop that is run in the “loop_dates” dataset. This would result in generating “Animated_Date” values for ONLY the values that are in the source data.
Staying with the example from the article, you would want to replace the data step that creates the “loop_dates” data with the following code:
/*get a distinct list of dates*/
proc sql;
create table dateList
as select distinct date from Fourth_of_July_Sale;
quit;
/*transpose the distinct list of dates*/
proc transpose data=dateList out=dateList;
var date;
run;
/*convert the transposed list into a single string with a separator*/
data getList;
set dateList;
drop _NAME_;
result=catx(',',of col:);
run;
/*save the output string to the macro variable "dateList"*/
data _NULL_;
set getList;
call symput('dateList',result);
run;
/* loop though the dates and output the record from each loop */
/* using only the dates that existed in the original data */
data loop_dates;
set Fourth_of_July_Sale;
do i=&dateList;
output;
end;
format i date9.;
rename i=Animation_Date;
run;
Hope this modified example helps in re-creating the graph with your data!
Thanks!
Mike
... View more