Hi,
I am trying to drop rows of data that do not have 12/31 as their month and day. Does anyone know how to do this?
Example:
Historical CRSP PERMNO Link to COMPUSTAT Record | Data Date |
54594 | 5/31/18 |
54594 | 5/31/19 |
54594 | 5/31/20 |
21020 | 12/31/18 |
21020 | 12/31/19 |
21020 | 12/31/20 |
11499 | 12/31/18 |
DROP ALL DATES THAT ARE NOT 12/31.
Is your date variable numeric with a format like mmddyy8?
If so then you can get the Month from the date with the Month function, which returns the number of the month, and the Day function returns the number of the day in a month.
data want; set have; if month(datevar)=12 and day(datevar)=31; run;
If used this way, without a "then" subsets the data by keeping the values the condition is true for.
From what you showed I am not sure what the name of your variable is because "data date" is not a standard SAS variable name.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: