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!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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: