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.
.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.