Hello @simkinm2 You didn't show us your expected output structure, but the logic is clear though
data testdate;
input admit_date :mmddyy10. discharge_date :mmddyy10.;
format _all_ mmddyy10.;
datalines;
6/29/2019 8/26/2019
12/27/2018 4/3/2019
;
data want;
set testdate;
d =admit_date;
do while(d<discharge_date);
month_year=put(d,monyy7.);
if month(d)=month(admit_date) then days=intnx('mon',d,0,'e')-d+1;
else if month(d)=month(discharge_date) then days=day(discharge_date);
else days=day(intnx('mon',d,0,'e'));
output;
d=intnx('mon',d,1);
end;
drop d;
run;