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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.