Date: Thu, 18 Jul 1996 11:24:00 CET
Reply-To: gio <ferro@UNI2A.UNIGE.CH>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: gio <ferro@UNI2A.UNIGE.CH>
Organization: only when absolutely necessary
Subject: %scan and counting # of delimiters ? a macro question
I have a simple macro which I would like to improve (but can't).
The purpose of the macro is to delete missing observations of relevant
variables in a dataset which are needed for further use in PROC IML.
The variables are stored in a macro, say;
educ married sex income
(Well, the `%let myvars=...' form could also be used, I suppose)
I've written the following macro which does a nice job:
%do i=1 %to &n;
if %scan(&varlist,&i,%str( ))=. then delete;
The ugly part is that I have to specify myself the number of
variables stored in the macro, and it can be tedious to trace it and
So my question is: how can I let SAS determine the number of variables
in the macro which is then %scanned ?
Can the number of delimiters (here single spaces) be stored somehow?
Thanks for any tip.