When I tried to write a loop over some arguments countw gave me the answer that "where Gruppe=1!where Gruppe=2" consists of four words when using "!" as delimiter. Shouldn't it be 2?
I used countw as shown in the log below.
61 %macro test;
Looking at parentheses the ! is interpreted as a parameter for %sysfunc and not of countw. You're better of with
%sysfunc(countw(&Beds.,!));
Hope this helps,
- Jan
Looking at parentheses the ! is interpreted as a parameter for %sysfunc and not of countw. You're better of with
%sysfunc(countw(&Beds.,!));
Hope this helps,
- Jan
Your parentheses are in the wrong place. This works. I deleted other extra characters that you do not need.
%macro test;
%let a=%sysfunc(countw(where Gruppe=1!where Gruppe=2,!));
%put &a;
%mend;
%test
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.