I wanted some help to get some string manipulation functions working in my SAS program.
I have a data set which has a column called file with the absolute path of SAS dataset files in a particular specified location on File System. The data set looks something like..
file
----------------------
C:\MySAS\MyData\Folder1\unit1.sas7bdat
C:\MySAS\Folder2\unit2.sas7bdat
C:\MySAS\Folder3\unit3.sas7bdat
...
..
And so on
What I want to do is, for each entry in the dataset I want to get the dataset name
In the above example, for first entry C:\MySAS\MyData\Folder1\unit1.sas7bdat
I want to get "unit1.sas7bdat" string extracted.
I tried to use the index function..INDEX(file,'\');
but don't know how to use it recursively to get till the last slash. After getting the index of last '\' I thouguht I can use substring to get the part of string from that index onwards.
[BTW, is there any function that returns the index of last occurence of a character in string..like in Java there lastindexof(String,character)]
Any pointers , help on this?
Any help much appreciated!
Thanks,
Neelam