vassilisef
Technical User
Hey !
i am not a much experienced user and i would like your help.
I have two SAS datasets only including dates.
Dataset1: 'Pract.Listofdates' containing just one variable
ie. a list of Xdates
Dataset2: 'Pract.Nber_expansion' containing two variables/ lists of dates : a startdate & an enddate so that each observation defines one time interval.
My aim is to see whether each individual Xdate (1st dataset) can be traced in ANY of the intervals defined by the 2nd dataset.
Namely, somehow, i need to retain one Xdate value until it runs through all the date intervals before i move to the next Xdate.
My best effort (that is wrong .. although i did not have any Errors at the log) would be:
Any corrections or alternative coding (with SQL etc) are strongly welcomed.
Thanks in advance.
i am not a much experienced user and i would like your help.
I have two SAS datasets only including dates.
Dataset1: 'Pract.Listofdates' containing just one variable
ie. a list of Xdates
Dataset2: 'Pract.Nber_expansion' containing two variables/ lists of dates : a startdate & an enddate so that each observation defines one time interval.
My aim is to see whether each individual Xdate (1st dataset) can be traced in ANY of the intervals defined by the 2nd dataset.
Namely, somehow, i need to retain one Xdate value until it runs through all the date intervals before i move to the next Xdate.
My best effort (that is wrong .. although i did not have any Errors at the log) would be:
Code:
data pract.assignstate;
set Pract.Listofdates Pract.Nber_expansion;
retain retainedate;
do retainedate=Xdates;
length status $11;
if startdate le retainedate le enddate then status='expansion';
else status='contraction';
end;
keep Xdates status ;
run;
Any corrections or alternative coding (with SQL etc) are strongly welcomed.
Thanks in advance.