Date: Tue, 4 Jan 2011 10:35:05 -0800
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: Love With SAS - My Vote for my favorite SAS Programming
Content-Type: text/plain; charset=utf-8
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Chang Chung
> Sent: Tuesday, January 04, 2011 9:30 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Love With SAS - My Vote for my favorite SAS Programming
> Language "Feature"
> On Thu, 30 Dec 2010 19:49:37 -0500, Arthur Tabachneck
> >From now until the New Year is usually a really quiet time for SAS-L,
> >MMMMIIIIKKKKEEEE's post showed us that doesn't have to be the case.
> >Thus, in an effort to keep the list from having a sad, lonely New
> >I thought that one extra thread might provide the necessary stimulus.
> >And, to get things going, my vote is for the ever increasing functions
> >keep being added with each version.
> >What's yours?
> I love the syntax of the (iterative) do statement, which is flexible
> without being fussy:
> DO index-variable = spec1, spec2, ..., specn;
> where spec# denotes:
> start <TO stop> <BY increment> <WHILE(exp)|UNTIL(exp)>
I also like the flexibility of the DO loop control structure, but it can bite you if you don't understand that the specs separated by commas are independent. There has been more than one thread on SAS-L that dealt with this issue (although I can't find them at the moment). For example,
Done = 0;
Do j = 1, 3, 5, 7 until(done);
If j > 1 then done=1;
In the above example, the until() clause only applies to the final comma-separated group (i.e. when j=7). This has confused even some seasoned SAS programmers.
Hope this is helpful,
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204