EXAMPLE 1

"Notice that the first text string appears at the top of the first worksheet as expected. However, the text from the second ODS TEXT= statement appears at the bottom of this same page rather than at the top of the next worksheet containing the related data table. This behavior illustrates that the ODS TEXT= option is not very flexible. There is no good way to solve this issue."

If you look in the RESULTS tab, you will see a line before the proc print, indicating that the first ods text= statement belongs to another group.
But given that it not considered as OUTPUT (sheet_interval='output' by default), no distinct worksheet is created for this first statement.

EXAMPLE 2

For the second example, I would rather write :

ods excel file="c:\scratch\example2.xlsx";
ods excel options(sheet_name="Females" sheet_interval="none");

proc odstext;
p "Data for Female Patients";
run;

proc print data=sashelp.class(where=(sex="F"));
run;

ods excel options(sheet_name="Males" sheet_interval="now");

proc odstext;
p "Data for Male Patients";
run;

proc print data=sashelp.class(where=(sex="M"));
run;

ods excel close;

But bear in mind that if titles are used and proc odstext is after proc print, then the result won't exactly be as expected on the second worksheet.

ods excel file="c:\scratch\example2bis.xlsx";
ods excel options(embedded_titles='yes' sheet_name="Females" sheet_interval="none");

title 'Female';
proc print data=sashelp.class(where=(sex="F"));
run;
title;

proc odstext;
p "Data for Female Patients";
run;

ods excel options(sheet_name="Males" sheet_interval="now");

title 'Male';
proc print data=sashelp.class(where=(sex="M"));
run;
title;

proc odstext;
p "Data for Male Patients";
run;

ods excel close;