Date: Tue, 17 Oct 2006 13:06:56 -0400
Reply-To: Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Subject: Re: Macro with keyword parameters and PARMBUFF
and so on, also supporting character variable lists and values, all in the
same call. I am improving the internal algorithm currently and yet want to
support values ranges using _THRU_ (SPSS's THRU). I won't support variable
ranges with TO (or _TO_ or - or --) because SAS and SPSS differ too much in
their support for them. In SPSS you can't choose: if the variables exist, TO
denotes an existing variable range from the PDF (like --), if they (both)
don't, TO denotes a range indicated by names with sequence numbers (like -).
Maybe I'll implement a purely SAS compatible solution (- and --) once
later, that I may use in other macros too.
Missing values also differ too much between SAS and SPSS. SPSS knows MISSING
(user defined) and SYSMIS (standard single system missing value). My
_SYSMIS_ refers to all 28 SAS missing values, but one may specify (a)
Furthermore, as an extension to SPSS, instead of values one may also specify
variable names, thus comparing variables per record (not with value ranges).
Noone was able to suggest a better solution regarding the positional and
keyword arguments; there hardly may be a better solution. I am satisfied
with the current syntax solution that I implemented; close to what I had in
Regards - Jim.
Jim Groeneveld, Netherlands
Statistician, SAS consultant
On Tue, 17 Oct 2006 11:30:56 -0400, data _null_; <datanull@GMAIL.COM> wrote:
>I see more clearly now.
>Is the following interpreted as
>Counter=a b c (3, 5, 7, _sysmis_) b a (1, 9)),
>count number of 3s 5s 7s and missings in vars A B C
>count number of 1s and 9s in vars B A.
>store that count in variable COUNTER.
>On 10/17/06, Jim Groeneveld <firstname.lastname@example.org> wrote:
>> Hi Data_NULL_,
>> It is not possible to copy the syntax of SPSS for 100%. Because of
>> differences between SAS and SPSS, in particular regarding missing values,
>> there will be differences in syntax, but it is possible to allow a SAS macro
>> to come close to the SPSS syntax.
>> After much deliberation and writing working code with quite different syntax
>> this is what it's going to be:
>> %MACRO Count (Counting, Debug=0); %* Macro definition;
>> %COUNT ((Counter=a b c (3, 5, 7, _sysmis_) b a (1, 9)), Debug=1); %* call;
>> Both variable names and values may be separated by spaces and commas.
>> Variable lists and value lists should be separated by parentheses only.
>> The whole SPSS-like command must be enclosed within inner parentheses when
>> called. Otherwise SAS complains about positional arguments after keyword
>> arguments, even though the definition does not contain an =.
>> After the SPSS-like command any keyword argument may be added, here the
>> Debug argument (more to be added yet).
>> The rest will (hopefully) be presented at the coming SGF.
>> Regards - Jim.
>> Jim Groeneveld, Netherlands
>> Statistician, SAS consultant