data have; input Person_ID $ date Date9. Sport $ ; format date date9.; datalines; 1234 20FEB2020 Football 1234 20FEB2020 Basketball 1234 25FEB2020 Ski 1234 07SEP2020 Football
How would I create a variable that says 'Y' for line 1 and 4 because there is at least a 6 month difference between the two days; and 'Y' for line 3 because it is a different type of sport? I want 'N' if it is on the same day and has a different sport, 'Y' if it is on a different day and a different sport, and 'Y' if the same (or different) sport is played with a 6 month difference.
Anything involving "different type of sport" is going to involve having a list or format that can assign every value of sport of encountered into a "type" category.
So you might start with listing all of your sports and what category you want to use for each.
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.