Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Count the number of obs in a macro variable

2 views
Skip to first unread message

Takatsugu

unread,
Dec 10, 2009, 2:27:39 PM12/10/09
to
Hi,

I am a newbie to SAS and use SAS at work while I have experience in
using R for a while.

I would like to know how to automatically determine the length of
&vars (=5) instead of declaring 10 in the below script....

%let vars = A B C D E;

data _NULL_;
do i = 1 to 10; <---- this value of 10 is what I would like to
automate when I change &vars.
letter = scan(&vars., i, ' ');
put i letter;
if letter = " " then leave;
end;
run;

Any help is appreciated!!!

Thanks.

Taka

how can I automatically count the number of itesm in this macro
variable?

Bruce Weaver

unread,
Dec 10, 2009, 3:48:24 PM12/10/09
to
On Dec 10, 2:27 pm, Takatsugu <taquito2...@gmail.com> wrote:
> Hi,
>
> I am a newbie to SAS and use SAS at work while I have experience in
> using R for a while.
>
> I would like to know how to automatically determine the length of
> &vars (=5) instead of declaring 10 in the below script....

--- snip ---

If you were aiming for comp.soft-sys.sas, you missed. This is the
SPSS group.

--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."

0 new messages