Hi,
I have a list of dates with Level and location wise,so i want require dates between below dates.Please help out.
So DT is equal to 02OCT... in your fist obs and 06OCT... in the second obs. You then want three observations in between with the 3. 4. and 5. oft Oct, correct?
Ok. Do you have a SAS/ETS license?
Here is one way
data have;
input LEVEL1 $ LOCATION_PL_EMP_MASTER $ 7-16 DT :datetime17.;
format DT datetime17.;
infile datalines4 dlm='|';
datalines;
India|Hyderabad |02Oct2019 0:00:00
India|Hyderabad |06Oct2019 0:00:00
India|Hyderabad |08Oct2019 0:00:00
India|Hyderabad |13Oct2019 0:00:00
India|Mumbai |02Oct2019 0:00:00
India|Mumbai |03Oct2019 0:00:00
India|Mumbai |04Oct2019 0:00:00
India|Mumbai |05Oct2019 0:00:00
India|Mumbai |06Oct2019 0:00:00
India|Mumbai |08Oct2019 0:00:00
India|Mumbai |10Oct2019 0:00:00
India|Mumbai |11Oct2019 0:00:00
India|Mumbai |12Oct2019 0:00:00
India|Mumbai |13Oct2019 0:00:00
India|Mumbai |14Oct2019 0:00:00
India|Mumbai |15Oct2019 0:00:00
India|Mumbai |16Oct2019 0:00:00
India|Mumbai |17Oct2019 0:00:00
India|Pune |02Oct2019 0:00:00
India|Pune |06Oct2019 0:00:00
India|Pune |07Oct2019 0:00:00
India|Pune |08Oct2019 0:00:00
India|Pune |11Oct2019 0:00:00
India|Pune |12Oct2019 0:00:00
India|Pune |13Oct2019 0:00:00
India|Vijayawada|02Oct2019 0:00:00
India|Vijayawada|03Oct2019 0:00:00
India|Vijayawada|06Oct2019 0:00:00
India|Vijayawada|08Oct2019 0:00:00
India|Vijayawada|13Oct2019 0:00:00
;
data want(drop=_:);
do until (last.LOCATION_PL_EMP_MASTER);
set have;
by LOCATION_PL_EMP_MASTER notsorted;
if first.LOCATION_PL_EMP_MASTER then _from=DT;
if last.LOCATION_PL_EMP_MASTER then _to=DT;
end;
do DT=_from to _to by 86400;
output;
end;
run;
Please post data in usable form and the expected result with that data.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.