Date: Wed, 6 Jun 2001 22:39:40 -0400
Reply-To: Richard DeVenezia <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Richard DeVenezia <radevenz@IX.NETCOM.COM>
Organization: MindSpring Enterprises
Subject: Re: How to make a dataset with 0 observations?
Here are a few more
data new;
x=y;
if 0;
run;
data new(where=(0));
x=y;
run;
data new;
if x+y;
run;
any mathematical or comparitive operator (except =) will also work
if x-y;
if x>y;
etc...
--
Richard DeVenezia - SAS Macros and AF Tools
http://www.devenezia.com
"John Whittington" <John.W@MEDISCIENCE.CO.UK> wrote in message
news:3.0.1.32.20010606180547.008fbb30@pop3.powernet.co.uk...
> 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
> ----------------------------------------------------------------
|