Date: Wed, 10 Jul 2002 08:32:49 -0400
Reply-To: lpogoda <lpogoda@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: lpogoda <lpogoda@HOTMAIL.COM>
Subject: Re: simple macro help
Content-Type: text/plain; charset="iso-8859-1"
My office is still using v6.12 (we're planning to switch over later this
year), so I was unaware that the DEVICE option was no longer an option.
I find this astonishing - the ancient PROC EDITOR is still available in
v8.2, and if there's anything that has little or no user demand, I'd expect
that to be at or near the top of the list.
----- Original Message -----
From: "Peter Crawford" <peter.crawford@db.com>
To: <sas-l@listserv.uga.edu>
Cc: <lpogoda@hotmail.com>; <tir@IGIDR.AC.IN>
Sent: Tuesday, July 09, 2002 5:35 PM
Subject: Re: simple macro help
to solve the problem posed by Tirthankar C. Patnaik (tir@IGIDR.AC.IN)
Lou Pogoda asks the entirely reasonable question
"Whyever not? .... There's certainly nothing in the
documentation indicating that PIPEs and the FILEVAR option are mutually
incompatible."
Unfortunately, my experience is just that..
.... the "filevar=" infile is incompatable with "device="
I discovered that v8 has removed the facility
!!! which previously was most useful in v6 for "device=dde" !!!
SI consider there is not enough demand to
reinstate the functionality !!
So I tested Lou's code in v8.1 to see if PIPE fares
better than DDE
... here is the log with error
The problem is not the device, it is just that
infile no longer supports "device="
6 DATA _NULL_;
7 INPUT @1 FILEVAR $CHAR20.;
8 DO UNTIL(DONE);
9 INFILE XX FILEVAR = FILEVAR END = DONE DEVICE = PIPE;
------
23
ERROR 23-2: Invalid option name DEVICE.
10 INPUT;
11 PUT _INFILE_;
12 END;
13 CARDS;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used:
real time 0.53 seconds
cpu time 0.07 seconds
16 ;
17 RUN;
Here is a possible alternative, trying the device/
filename-engine on the filename statement
hoping it will be inherited by the infile statement
42 filename xx pipe 'command string' ;
43 DATA _NULL_;
44 INPUT @1 FILEVAR $CHAR20.;
45 DO UNTIL(DONE);
46 INFILE XX filevar=filevar END=DONE ;
47 INPUT;
48 PUT _INFILE_;
49 END;
50 CARDS;
ERROR: A component of e:\users\crawford\sas8\DIR C:\ is not a directory.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+
----7----
51 DIR C:\
FILEVAR=DIR C:\ DONE=0 _ERROR_=1 _INFILE_=DIR C:\ _N_=1
NOTE: The SAS System stopped processing this step because of errors.
Clearly, the pipe filename engine defined for fileref XX is
ignored, once the filevar= option is executed in the step
The last recommendation I heard form SI was to use
multiple filename statements to implement each
separate dde range (my objective for filevar=)
Perhaps Tirthankar must accept the weak workaround
with multiple filename statements generated, but many
of us are considering that this demonstrates that this
is functionality that
*should* *not* *have* *been* *dropped*
from the data step
with much disappointment
Peter Crawford
From: Lou Pogoda (lpogoda@hotmail.com)
Subject: Re: simple macro help
Newsgroups: comp.soft-sys.sas
Date: 2002-07-09 06:09:02 PST
"Ian Whitlock" <WHITLOI1@WESTAT.COM> wrote in message
news:08B08C9FA5EBD311A2CC009027D5BF8102E2B193@remailnt2-re01.westat.com...
> Tirthankar,
>
> As lpogoda [lpogoda@HOTMAIL.COM] suggests the FILEVAR option is often
useful
> when reading many external data sets in to a SAS data set. If the files
> were plain flat files it would provide the best solution. However, your
> files are zipped and I do not think that strategy would work without
> unzipping all your files first.
> [[remainder snipped]]
Whyever not? I don't know exactly what platform the original poster was on
or what release of SAS is being used, but presumably this series of files is
going to be read using an unnamed PIPE. There's certainly nothing in the
documentation indicating that PIPEs and the FILEVAR option are mutually
incompatible.
An illustration that they are compatible (on a wintel platform, anyway) is
the following short program:
DATA _NULL_;
INPUT @1 FILEVAR $CHAR20.;
DO UNTIL(DONE);
INFILE XX FILEVAR = FILEVAR END = DONE DEVICE = PIPE;
INPUT;
PUT _INFILE_;
END;
CARDS;
DIR C:\
DIR C:\ALLDATA
;
RUN;
which, when run, writes to the LOG the same text you would see if you opened
a DOS window and typed the two DIR commands manually.
I don't have whatever utility BUNZIP may be, but I know of no reason to
suppose, a priori, that it would be incompatible with this technique. And I
submit that the process exemplified by the above DATA step, where you just
read your files and be done with it, is far simpler than the macro plus data
step plus call execute combination. As I said earlier, the functionality is
already there, built into the language.
--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.