@alepage wrote: Your script works very well. Could you please provide me documentation on scan function with p, l, m. Also, what's the purpose of the call. where does go the information? Can we replace the call by a macro variable like %let fifth=scan(text,5,p,l,'/','m');
CALL SCAN() is what SAS calls a ROUTINE rather than a FUNCTION. The CALL routines are documented with the other functions. Look under C in the alphabetical lists. The main difference is that a call routine can modifier the values of variables used as arguments. That let's them return more than just a single value, like a function does.
You can put any text you want into a macro variable. And then expand the macro variable wherever you want that text to become part of your code. So if you made a macro variable with that text:
%let fifth=scan(text,5,p,l,'/','m');
You could then use it to generate that part of the CALL SCAN routine call in some later data step.
data ....
call &fifth;
...
But that just seems silly.
If you wanted the actually execute the CALL SCAN() routine in pure macro code you should look into using the %SYSCALL macro statement.
Example:
1 %let text=/dwh_actuariat/sasdata/sas1999/nx/ingnovex.rd016y.prm.jun1999.dat.Z;
2 %let start=0;
3 %let length=0;
4 %let n=5;
5 %let dlm=/;
6 %let modifiers=m;
7 %syscall scan(text,n,start,length,dlm,modifiers);
8 %let position=%eval(&start+&length);
9 %put &=start &=length &=position ;
START=32 LENGTH=2 POSITION=34
... View more