| 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
it |
|
| In-Reply-To: | <CAHj_gPeAjzowWZj7s5q8MV3rCQ9enABHkD90PhUXGOoJca__zA@mail.gmail.com> |
| 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:
http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm
The OF construct is discussed in more detail at:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002295632.htm
Mike Rhoads
RhoadsM1@Westat.com
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Mary Rosenbloom
Sent: Wednesday, September 21, 2011 2:29 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: sum(of card: ) this works but I can't find documentation for it
Thanks! I feel a bit better about this now.
Cheers,
Mary R.
On Wed, Sep 21, 2011 at 11:23 AM, Joe Matise <snoopy369@gmail.com> 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
> somewhere.
> -Joe
> On Wed, Sep 21, 2011 at 1:05 PM, Mary Rosenbloom
> <mary.rosenbloom.sas@gmail.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.
>>
>> Cheers,
>> Mary R.
>
>
|