<div dir="ltr">Good Morning Everyone,<div><br></div><div>I have essentially two questions. I am trying to subset a an existing dataset based on the last two business days of each month in the dataset. I am able to subset based on the last business day of each month (or the last day as I am only using business days in my dataset) via the following code:</div><div><br></div><div><div>##identify second to last business day of every month</div><div>month_end = lookback_returns_nona[endpoints(lookback_returns_nona, on="months"),]</div></div><div><br></div><div>However, I do not have to make this the second to last day instead. In addition, can someone help me understand how I could do the last business day of each month and the second to last business day of each month?</div><div><br></div><div>My dataset simply contains a date index, and a few variables with daily returns:</div><div><br></div><div><br></div><div><img src="cid:ii_150af830821bd87c" alt="Inline image 1" width="323" height="87"><br></div><div><br></div><div>As a side note, I am new to the forum so please feel free to let me know if I am not observing proper posing rules. Thanks in advance as any help would be extremely useful.</div><div><br></div><div>Kind Regards,</div><div><br></div><div>AG</div></div>