Type : INTERNAL_CREATION
The macro operates on a character string provided as a parameter ('pth') and does not read data from SASHELP tables or external sources. It manipulates character strings in memory to construct the result.
| 1 | %macro getFileStem(pth)/des="Extract the path without the file name and extension"; |
| 2 | %local revstr cutstr gotstm; |
| 3 | %let revstr=%qleft(%qsysfunc(reverse(&pth))); |
| 4 | %let cutstr=%qsubstr(&revstr,%qsysfunc(indexc(&revstr,%str(/\)))); |
| 5 | %let gotstm=%qleft(%qsysfunc(reverse(&cutstr))); |
| 6 | %str(&gotstm) |
| 7 | %mend getFileStem; |