Date: Wed, 6 Jun 2001 13:24:04 -0400
Reply-To: "Shilling, Brian [PRI]" <BShillin@PRIUS.JNJ.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Shilling, Brian [PRI]" <BShillin@PRIUS.JNJ.COM>
Subject: Re: How to make a dataset with 0 observations?
Content-Type: multipart/alternative;
you could shorten the keystrokes even more by leaving out the data set name;
data;
x=y;
stop;
run;
would create a work dataset called DATA1.
How is that for messy?
Brian
> -----Original Message-----
> From: John Whittington [SMTP:John.W@MEDISCIENCE.CO.UK]
> Sent: Wednesday, June 06, 2001 1:06 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: How to make a dataset with 0 observations?
>
> At 12:02 05/06/01 -0400, Jay Weedon wrote:
>
> >Wow, I received about 6 responses in an hour. Thanks so much! Inspired
> >by them, I found yet another solution:
> >
> >data new;
> > x=.; y=.; delete;
> >run;
>
> If this has turned into a 'minimise the number of keystrokes' game, then:
>
> 1... STOP has two less characters than does DELETE, but works just as
> well.
>
> 2... If you don't mind the 'uninitialised' message in the log, you can
> make
> use of the fact that mention of a variable on the RIGHT hand side (as well
> as left hand side) of an assignment statement result in that variable
> being
> 'created', to knock off a further two keystrokes, with:
>
> data new;
> x=y; stop;
> run ;
>
> ... and, of course, if you really wanted to become a 'messy programmer',
> you could miss out the RUN statement as well, provided there was some
> subsequent step in the program! Hence my very best ('messy') offer would
> be:
>
> data new;x=y;stop;
>
> ... and I really can't see how you could reduce the number of keystrokes
> any further - you are always going to need a STOP (or DELETE) statement to
> prevent any observations being created, and you obviously must mention the
> two variables you want (X and Y); all that my 'best offer' has in
> addition
> that that is one equals sign, which is about as modest as you could get!
>
> Kind Regards,
>
>
> John
>
> ----------------------------------------------------------------
> Dr John Whittington, Voice: +44 (0) 1296 730225
> Mediscience Services Fax: +44 (0) 1296 738893
> Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk
> Buckingham MK18 4EL, UK mediscience@compuserve.com
> ----------------------------------------------------------------
[text/html]
|