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!
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!
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.
Ready to level-up your skills? Choose your own adventure.