Reputation: 433
Given the following macro variable:
%let var = name salary work;
I need to create a macro variable which has the number of the variables in the var. In this example, this newly created macro variable is equal to 3.
Upvotes: 1
Views: 159
Reputation: 63424
The basic concept here is using the COUNTW
function. You can't use that directly in a macro variable assignment though (in a %let
), but you can use %SYSFUNC
to enable you to use it.
%let var_count = %sysfunc(countw(&var.));
Note there are no quotation marks or similar.
Upvotes: 4