We're working with SAS here, not with Excel 😉
So please post data the SAS way, as DATA step code with datalines. In many professional environments, download of Office files is prevented for security reasons, and Excel file sdo not show us the variable attributes of your real dataset(s).
Instead of showing us the transposed dataset (which is much harder to work with), post the original "long" dataset.
Please show the long dataset, and post working code. You need a DATALINES statement and proper informats (use the INFORMAT statement) for at least the dates.
I take it that your original dataset contains at least three variables: subject, visit, date.
Sort by subject and visit (if you have visits with missing dates, remove them here with a dataset option); then, compare date with lag(date) to see if there's an incorrect order.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.