@Mscarboncopy wrote:
Hi. Any date with year 2018 is a mistake in coding. I am trying to generate a file with all of the 2018 dates so I can delete them from my data file. Most dates are before 2018 so it won't be 150 flags. The file has about 150 entries for different ids - some ids have 10 dates, some have 100, some have 150 (and several other variables). Thanks.
You suffer from a bad data structure. In a case where you have only 10 dates, the space for the other 140 columns is wasted needlessly.
The bigger problem you have is that you need to do complicated coding for a VERY SIMPLE issue.
With a long dataset layout, it is just
data want;
set have;
if Vdte ge '01jan2018'd;
keep ID Vdte; /*add any other variable needed, like SEQ derived from your original column name */
run;
So you should, as a first step in making your life easier, transpose your 150 columns to a long dataset layout, and drop any observations that have missing values.
... View more