Date: Wed, 27 Jan 2010 11:35:12 -0600
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: Interesting finding: Proc SQL create quoted name dataset!
In-Reply-To: <201001271719.o0RH55lJ017391@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Did you see my suggestion for using the DATAn naming convention for
naming data sets created and managed by macros? It seems "best" and
safest to me.
%macro main(data=sashelp.class,by=sex);
/* create macro variables and populate with DATAn names */
%local outest output;
data _data_; stop; run; %let outest = &syslast;
data _data_; stop; run; %let output = &syslast;
/* create sorted working data save name to WORKING */
%local working;
proc sort data=&data out=_data_;
by &by;
run;
%let working=&syslast;
/* use the DATAn names for output from proc reg */
proc reg data=&working outest=&outest noprint;
by sex;
model weight=height;
output out=&output r=r p=p;
run;
quit;
proc delete data=&outest &output &working;
run;
%mend main;
options mprint=1;
%main()
options mprint=0;
On 1/27/10, Ya Huang <ya.huang@amylin.com> wrote:
> A good one :-)
>
> Seriously, I'm thinking that maybe all datasets created and used inside
> macro should be quoted, so that they won't be mixed with dataset outside
> macro. This way, we'll never worry about overwrite the same named dataset.
>
> On Wed, 27 Jan 2010 04:20:02 -0800, montura <kevin@MONTURA.COM> wrote:
>
> >The best impliction woul be unreadable code - great for job security,
> >providing you never want a promotion.
>