Hello, Need a quick help!!
I'm defining a user-defined variable number of macro variables that I want to use later in my program.
Like
%let Alist1 = '00123','00124','00175'....; (400 variables)
%let Alist2 = '00163','00164','00165'....;(500 variables)
%let Alist3 = '00153','00154','00155'....;(300 variables)
I wanted to check the count of ALIST1 in my log using %PUT statement, not the actual values. Since I am not sure how many were there in some of the lists.
I tried like this,
%PUT = &Alist1 ;
%PUT = count( &Alist1) ;
I need something like this
Alist = 400??
Thanks for checking!
%put %sysfunc(countw(%BQUOTE(&Alist1),%str(,)));
Hi @Kalai2008
You can use the count() function and use it with the %sysfunc() function as you use macro language;
%put %sysfunc(countw("&Alist1"));
Thanks,
Log Error:
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
22
23 GOPTIONS ACCESSIBLE;
24 %put %sysfunc (countw(&AList1));
ERROR: The function COUNTW referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments.
.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.