I am trying to create a cumulative counter variable that tracks the total number games. The code I have been using can be found below. I am not sure how to word it so that the TotalGames column adds 1 for each new game, sorted by date. That way that the count is totaled based on the dates the games were played.
PROC SORT data = NewRoseBowl;
by Date;
RUN;
Data CountRoseBowl;
set NewRoseBowl;
TotalGames + 1;
by Date;
if first.date then TotalGames = 1;
PROC PRINT;
Format Date WEEKDATE30.;
RUN;
Do you want the total number of games for each date?
If so, why not run a PROC FREQ on the DATE variable?
No need for sorting, or a data step.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.