Hi-
I'm stuck... I need to identify a sample of records spaced by 2 days beginning on 1 April 1968 and ending on 31 July 1974. My initial approach of taking the days 1,3,5... obviously doesn't work.
My dataset contains the date (SAS format) as well as the month, day and year as individual variables. Ideally I would like the following:
t_date flag
3/1/1968 1
3/2/1968 0
3/3/1968 1
...
Thank you in advance for your help.
data have;
do date='01mar1968'd to '31jul1974'd;
flag=mod(date+1,2);
output;
end;
format date date9.;
run;
data have;
do date='01mar1968'd to '31jul1974'd;
flag=mod(date+1,2);
output;
end;
format date date9.;
run;
Thank you, this worked perfectly!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.