Date: Wed, 6 Jun 2001 18:05:47 +0100
Reply-To: John Whittington <John.W@MEDISCIENCE.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: John Whittington <John.W@MEDISCIENCE.CO.UK>
Subject: Re: How to make a dataset with 0 observations?
In-Reply-To: <E157K5x-0007n9-00@relay1.netnames.net>
Content-Type: text/plain; charset="us-ascii"
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
----------------------------------------------------------------