|
Craig,
Couldn't you just use the scan function? e.g.,:
data Example;
input FileName $ 1-38;
FinalID =scan(filename,3,'-');
datalines;
Assessment1-Sample-1234-1.txt
Assessment2-Whatever-12-3.edat
MakingThingsDifficult-Booo-567-2.txt
;
Art
---------
On Tue, 10 Nov 2009 14:29:49 -0600, Craig Johnson <cjohns38@GMAIL.COM>
wrote:
>I�m reading in directory contents using a dirlistwin macro (available
here:
>http://support.sas.com/kb/24/addl/fusion24820_1_dirlistwin.sas.txt) so I
can
>compare the files in a directory vs. what a database says we should
have. Each
>file is named in the basic following format Assessment-Whatever-#####-
#.txt
>or Assessment-Part2-##-1.txt. What I�d like to be able to do is split the
>string at the -###-#.txt so I end up with the first the digits between the
>��s. Below is an example of what I�m working with and the final outcome
I�m
>looking for. Any help on how to get there would be greatly appreciated.
>
>
>
>********************
>Sample Data Set
>
>********************;
>
>
>
>*data* Example;
>
> input FileName $*1*-*38* /*read from the Macro*/
>
> FinalID *39*-*44*/*The Final ID I need to match with the DB*/;
>
>datalines;
>
>Assessment1-Sample-1234-1.txt 1234
>
>Assessment2-Whatever-12-3.edat 12
>
>MakingThingsDifficult-Booo-567-2.txt 567
>
>;
>
>*run*;
|