Hi, everyone.
Would you mind share me an usage example of %syscall scan() ? Thanks.
@whymath wrote:
Hi, everyone.
Would you mind share me an usage example of %syscall scan() ? Thanks.
Oh, there is actually a call scan() routine. Never used it ever.
After some try and error below appears to work.
%let string=abc def ghi;
%let cnt=2;
%let pos=0;
%let len=0;
%syscall SCAN(string, cnt, pos, len );
%put &=cnt &=pos &=len;
CNT=2 POS=5 LEN=3
@whymath wrote:
Hi, everyone.
Would you mind share me an usage example of %syscall scan() ? Thanks.
%syscall() is for using call routines on macro level, %sysfunc() for using functions on macro level.
scan() is a SAS function.
But...using %sysfunc() for the scan() function is not necessary as you've also got macro function %scan() for this.
%let string=abc def ghi;
%put test1: %sysfunc(scan(&string,2));
%put test2: %scan(&string,2);
28 %let string=abc def ghi; 29 %put test1: %sysfunc(scan(&string,2)); test1: def 30 %put test2: %scan(&string,2); test2: def
@whymath wrote:
Hi, everyone.
Would you mind share me an usage example of %syscall scan() ? Thanks.
I rarely use call scan() it all, so i don't have an example at hand. Do you mind explaining the task you are working on (including some data), so that we can try to provide an example? Will functions/call-routines in the macro-world: don't use any kind of quotes.
@whymath wrote:
Hi, everyone.
Would you mind share me an usage example of %syscall scan() ? Thanks.
Oh, there is actually a call scan() routine. Never used it ever.
After some try and error below appears to work.
%let string=abc def ghi;
%let cnt=2;
%let pos=0;
%let len=0;
%syscall SCAN(string, cnt, pos, len );
%put &=cnt &=pos &=len;
CNT=2 POS=5 LEN=3
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.