|Date: ||Wed, 21 Sep 2011 18:56:31 +0000|
|Reply-To: ||Mike Rhoads <RHOADSM1@WESTAT.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Mike Rhoads <RHOADSM1@WESTAT.COM>|
|Subject: ||Re: sum(of card: ) this works but I can't find documentation for
|Content-Type: ||text/plain; charset="us-ascii"|
As far as the documentation goes, there's an on-point example at the following URL, in the subsection Name Prefix Lists:
The OF construct is discussed in more detail at:
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Mary Rosenbloom
Sent: Wednesday, September 21, 2011 2:29 PM
Subject: Re: sum(of card: ) this works but I can't find documentation for it
Thanks! I feel a bit better about this now.
On Wed, Sep 21, 2011 at 11:23 AM, Joe Matise <firstname.lastname@example.org> wrote:
> Macros aren't involved here; you're just describing one of SAS's
> variable list tricks (really, two of them).
> <function>(of variablelist) is how you incorporate a space delimited
> variable list; so sum (x,y,z) = sum(of x y z)
> var: is the wildcard shortcut for 'all variables starting with var',
> and is converted to a space delimited list of all variable names matching it.
> Not sure where in the doc it is listed, but I imagine it's in there
> On Wed, Sep 21, 2011 at 1:05 PM, Mary Rosenbloom
> <email@example.com> wrote:
>> Hi all,
>> I have several variables, all having the prefix "CARD", and all
>> having values of 1 or missing. I want to create one more variable,
>> "not answered" which will take the value of 1 if none of the other
>> variables have a value.
>> I decided to try this code, and it worked, but I can't find a
>> reference for it anywhere:
>> data try2;
>> set try1;
>> if sum(of card:) eq 0 then notanswered=1; run;
>> Does anyone know of an example of this in the docs? I am a little
>> hesitant to use this, since I can't turn on some analog of MPRINT to "see"
>> what is going on behind the scenes.
>> Thanks for your help.
>> Mary R.