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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.