You can use both a monthly or semimonthly intervals for calculating a midpoint in the month with INTNX() function. For a monthly interval, the alignment option of 'M' uses the 15th day as the midpoint. For semimonthly interval, the period is half-month with starting points on the 1st and 16th days of the month, so you can use the appropriate increment and alignment to get the right dates.
Here's one option:
data _null_;
dt = today();
format beg_month mid_month end_month yymmdd10.;
* uning monthly interval;
beg_month = intnx('month', dt, 0);
mid_month = intnx('month', dt, 0, 'm');
end_month = intnx('month', dt, 0, 'e');
put beg_month= mid_month= end_month=;
* using semimonth interval;
beg_month = intnx('semimonth', dt, -1);
mid_month = intnx('semimonth', dt, 0);
end_month = intnx('semimonth', dt, 0, 'e');
put beg_month= mid_month= end_month=;
run;
Output:
beg_month=2022-04-01 mid_month=2022-04-15 end_month=2022-04-30
beg_month=2022-04-01 mid_month=2022-04-16 end_month=2022-04-30
... View more