On Apr 14, 7:18 am, michaelrait...@WESTAT.COM (Michael Raithel) wrote:
> Dear SAS-L-ers,
> One of my colleagues inherited a very complicated 3,800 line SAS program th=
> at is generated by a large SAS macro program. Somewhere in the generated p=
> rogram, there is an occurrence of unmatched DO/END statements. That causes=
> the large SAS program to fail.
> Because of the length of the _MONDO_LARGE_ DATA step, finding the unmatched=
> DO/END statements is very, very, difficult.
> I told him that he should consider writing a quick-n-dirty SAS program that=
> eats the LARGE SAS program and notes all of the DO/END statements; keeping=
> track of them and flagging when it finds an END-less DO statement. I beli=
> eve that he is working on that endeavor.
> However, in the dim recesses of my mind, I seem to remember that somewhere =
> out there in computer land there is an editor that visually flags unbalance=
> d "stuff" in a SAS program with color coding. Do you know/remember any suc=
> h editor, or am I mistaken?
> Thank you for any insights that you can provide.
> Best of luck in all of your SAS endeavors!
> I hope that this suggestion proves helpful now, and in the future!
> Of course, all of these opinions and insights are my own, and do not reflec=
> t those of my organization or my associates. All SAS code and/or methodolog=
> ies specified in this posting are for illustrative purposes only and no war=
> ranty is stated or implied as to their accuracy or applicability. People de=
> ciding to use information in this posting do so at their own risk.
> Michael A. Raithel
> "The man who wrote the book on performance"
> E-mail: MichaelRait...@westat.com
> Author: Tuning SAS Applications in the MVS Environment
> Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second=
> Author: The Complete Guide to SAS Indexes
> Until you've lost your reputation, you never realize what a burden it was. =
> - Margaret Mitchell
I would use regular expressions. I think they will flag the offending
code rather than everything in compliance. For example:
Then search the matches for any that do not contain an end statement.
I did the pattern quickly so it may need tweaking but see if that gets