Date: Mon, 21 Nov 2011 12:34:40 -0500
Reply-To: Bolotin Yevgeniy <YBolotin@SCHOOLS.NYC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bolotin Yevgeniy <YBolotin@SCHOOLS.NYC.GOV>
Subject: Re: Array ( * ) and LAST. (Automatic SAS variables)
In-Reply-To: <CAEZCystULvwOFtOuv-=-659HjghvT6R2NPJzb4dF9KDCUt_oUA@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
"Maybe name ranges only work with data set variables not automatic variables. "
This is known to be true - for instance, _all_ and _numeric_ will never include your EOF variables, your IN variables, _N_, etc.
Name ranges probably work in a similar fashion - and since last.gender is not a real variable, it doesn't get resolved to anything when being looked up
-----Original Message-----
From: Data _null_; [mailto:iebupdte@gmail.com]
Sent: Monday, November 21, 2011 12:32 PM
To: Bolotin Yevgeniy
Cc: SAS-L@listserv.uga.edu
Subject: Re: Array ( * ) and LAST. (Automatic SAS variables)
If you're willing to turn on VALIDVARNAME=ANY you can include the dot
in the name root and make the make the array declaration a bit more
explicit.
Maybe name ranges only work with data set variables not automatic variables.
We need more testing?
On 11/21/11, Bolotin Yevgeniy <YBolotin@schools.nyc.gov> wrote:
> This compiles (doesn't produce an error), but doesn't actually work:
>
> array a(*) Last.Race:;
>
> produces a " WARNING: Defining an array with zero elements. " and actually
> produces a 0-length array
>
>
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Søren
> Lassen
> Sent: Monday, November 21, 2011 1:27 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Array ( * ) and LAST. (Automatic SAS variables)
>
> Pretty neat too - you can even do
> array a(*) Last.Race:;
> but for some reason not
> array a(*) Last.RaceAmIndian--Last.RaceWhite;
> Even more strange, you can do
> sum(Last.RaceAmIndian--Last.RaceWhite)
> but not
> sum(of last.race:)
> and
> last.:
> is not accepted anywhere.
>
> Which shows (I think) that we are moving somewhere in the uncharted
> territories of undocumented SAS behaviour - I would not be too sure
> of the above statements under different versions of SAS
> (I did my tests with 9.1 on Windows).
>
> On the other hand, I think Kevin's original code should be OK under all
> circumstances.
>
> Regards,
> Søren
>
> On Thu, 17 Nov 2011 20:26:09 +0000, Zdeb, Michael S <mzdeb@ALBANY.EDU>
> wrote:
>
>>hi, neat ... and if there are no other variables that begin with LAST to
> worry about, looks as if this is OK too ...
>>
>>array ldot(*) last: ;
>>
>>ps that's a lot of by variables
>>
>>Mike Zdeb
>>U@Albany School of Public Health
>>One University Place (Room 119)
>>Rensselaer, New York 12144-3456
>>P/518-402-6479 F/630-604-1475
>>
>>________________________________________
>>From: SAS(r) Discussion [SAS-L@LISTSERV.UGA.EDU] on behalf of Viel, Kevin
> [kviel@SJHA.ORG]
>>Sent: Thursday, November 17, 2011 2:34 PM
>>To: SAS-L@LISTSERV.UGA.EDU
>>Subject: Array ( * ) and LAST. (Automatic SAS variables)
>>
>>This is probably barely worth the post, but it saved me some trouble today
> while debugging an error. Happily, one can use the SAS automatic variable
> LAST. As elements of an Array:
>>
>> Array Ldot ( * ) Last.Gender
>> Last.PCI_Lesions_Attempted
>> Last.Diabetes
>> Last.Hypertension
>> Last.Dyslipidemia
>> Last.RaceAmIndian
>> Last.RaceAsian
>> Last.RaceBlack
>> Last.RaceNatHaw
>> Last.RaceWhite
>> Last.HispOrig
>> ;
>>
>>Cheers,
>>
>>Kevin
>>
>>
>>Kevin Viel, PhD
>>Senior Research Statistician
>>Patient Safety & Quality
>>International College of Robotic Surgery
>>Saint Joseph's Translational Research Institute
>>
>>Saint Joseph's Hospital
>>5671 Peachtree Dunwoody Road, NE, Suite 330
>>Atlanta, GA 30342
>>
>>(678) 843-6076: Direct Phone
>>(678) 843-6153: Facsimile
>>(404) 558-1364: Mobile
>>kviel@sjha.org
>>Confidentiality Notice:
>>This e-mail, including any attachments is the
>>property of Catholic Health East and is intended
>>for the sole use of the intended recipient(s).
>>It may contain information that is privileged and
>>confidential. Any unauthorized review, use,
>>disclosure, or distribution is prohibited. If you are
>>not the intended recipient, please delete this message, and
>>reply to the sender regarding the error in a separate email.
>
|