Date: Thu, 6 Nov 2003 12:38:59 -0500
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Filevar And Name With Embedded Spaces Or Special Characters
It's simple to check if that is the reason (which I don't believe): put
some bytes into that file, only for testing. Do you get another message?
On Thu, 6 Nov 2003 11:57:00 -0500, Gerry <GPauline@FSMAIL.PACE.EDU> wrote:
>Harry:
>
>You are right, the embedded spaces and characters in the filename are not a
>problem. It seems that I miss read/interpreted the error message. The
>SASLOG note is a little misleading, the file does exist, it just has zero
>bytes !
>
>It seems I have to check for a zero byte condition before processing the
>file !
>
>-Gerry
>
>---------------------------------------------------------------------------
-
>----------------
>
>NOTE: The infile DUMMY is:
> File Name=C:\TestIMAP\lsippel\Pres-Exec
>Council-VPs-Deans\President.mbx,
> RECFM=V,LRECL=256
>
>NOTE: The infile DUMMY is:
> File Name=C:\TestIMAP\lsippel\VP Academic Affairs - EVP\VPAA School
of
>Law.mbx,
> RECFM=V,LRECL=256
>
>NOTE: The infile DUMMY is:
> File Name=C:\TestIMAP\lsippel\VP Academic Affairs - EVP\VPAA School
of
>Education.mbx,
> RECFM=V,LRECL=256
>
>ERROR: Physical file does not exist, C:\TestIMAP\lsippel\VP Academic
>Affairs - EVP\VPAA School of
> Computer Science &- Information Systems.
>RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----
+-
>---7----+----8----+---
>84 C:\TestIMAP\lsippel\zz personal\zz confidential.mbx 51
>CHECK=
>FNAME=C:\TestIMAP\lsippel\VP Academic Affairs - EVP\VPAA School of Computer
>Science &- Information
> Systems DESC=C:\TestIMAP\lsippel\VP Academic Affairs - EVP\VPAA School of
>Education.mbx NoF=84
>EOF=1 F=71 MSG_COUNT=0 EOF2=1 STR= _ERROR_=1 _INFILE_= _N_=1
>NOTE: 84 records were read from the infile FILELIST.
> The minimum record length was 28.
> The maximum record length was 104.
>NOTE: The SAS System stopped processing this step because of errors.
>WARNING: The data set WORK.MESSAGES may be incomplete. When this step was
>stopped there were 70
> observations and 1 variables.
>WARNING: Data set WORK.MESSAGES was not replaced because this step was
>stopped.
>NOTE: DATA statement used (Total process time):
> real time 2.37 seconds
> cpu time 1.88 seconds
>
>
>271
>272 Proc PRINT Data=MESSAGES ;
>273 Run ;
>
>NOTE: No observations in data set WORK.MESSAGES.
>NOTE: PROCEDURE PRINT used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
>
>
>
>
>---------------------------------------------------------------------------
-
>----------------
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of
>Droogendyk, Harry
>Sent: Thursday, November 06, 2003 9:32 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Filevar And Name With Embedded Spaces Or Special Characters
>
>
>The first datastep can be replaced with the > redirection, or whatever it's
>called DOS, to create the feeding text file:
>
>I don't seem to have a problem reading filenames with embedded spaces or
>ampersands. Note that I've changed your second datastep a tad, infile
>options. Output follows the program.
>
>How exactly does your program choke? Log etc.. may be helpful.
>
>
>options noxwait;
>x "dir C:\temp\*.sas /S /B /O-D > c:\temp\files_x.txt";
>
>Data MESSAGES (Keep=filename MSG_COUNT) ;
> Length FNAME DESC $ 150 ;
> Infile 'C:\temp\Files_x.TXT' Lrecl=150 pad missover ;
> Input @1 FNAME $150. ;
> filename = fname;
> Infile DUMMY Filevar=FNAME End=EOF pad missover ;
>
> MSG_COUNT = 0 ;
> Do While (^EOF) ;
> Input @1 STR $Char6. ;
> If (STR = '%macro') Then MSG_COUNT + 1 ;
> End ;
> Output MESSAGES ;
>Run ;
>
>options nocenter;
>Proc PRINT Data=MESSAGES ;
>Run ;
>
>The SAS System 09:11
>Thursday, November 6, 2003 10
>
> MSG_
>Obs filename COUNT
>
> 1 C:\TEMP\model 41 42.sas 2
> 2 C:\TEMP\build model & views.sas 2
> 3 C:\TEMP\model_feed_macro.sas 1
> 4 C:\TEMP\mariam_mcc_5311_merge_sample.sas 0
> 5 C:\TEMP\mariam_mcc_5311.sas 1
> 6 C:\TEMP\mariam_mcc_5311_merge_sample_id.sas 0
> 7 C:\TEMP\delimiter2.sas 0
>
> -----Original Message-----
> From: Gerry [mailto:GPauline@FSMAIL.PACE.EDU]
> Sent: November 6, 2003 9:03 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Filevar And Name With Embedded Spaces Or
>Special Characters
>
> SAS-Pros:
>
> Sometimes I forget just how great a tool SAS is and how
>extraordinary
> the SAS-L list is -- you guys answer questions before they
>are asked !
> I also apologize for the length of this note !
>
> I have to read through a directory structure and
interrogate
>files with
> a particular file extension. Recent notes from Jack and
>Harry provided a
> quick and easy way to traverse the directory structures:
>
> Filename FILELIST Pipe "dir C:\ /S /B /O-D";
>
> Data _NULL_ ;
> Length CHECK $ 3 ;
> Infile FILELIST Lrecl=256 Truncover ;
> File 'C:\Files.TXT' ;
> Input ;
> CHECK = Reverse(Substr(Reverse(Trim(_INFILE_)), 1, 3)) ;
> If (Upcase(CHECK) = 'MBX') Then
> Put @1 _INFILE_ ;
> Run ;
>
> The above code, using the PIPE, does exactly what I need;
>I'm only
> interested in files with a ".mbx" extension. I then want to
>count the
> number of new message headers per .MBX file. This code
>performs the task:
>
> Data MESSAGES (Keep=DESC MSG_COUNT) ;
> Length FNAME DESC $ 50 ;
> Infile 'C:\Files.TXT' Lrecl=256 Truncover ;
> Input @1 FNAME $150. ;
> Infile DUMMY Filevar=FNAME Filename=DESC End=EOF ;
> * ACCT = Scan(DESC, 1, ' ') ;
> MSG_COUNT = 0 ;
> Do While (^EOF) ;
> Input @1 STR $Char6. ;
> If (STR = 'From: ') Then MSG_COUNT + 1 ;
> Else Continue ;
> End ;
> Output MESSAGES ;
> Run ;
> Proc PRINT Data=MESSAGES ;
> Run ;
>
> "Standardly" (if there is such a thing on Windows systems)
>named files,
> like below, cause no problem:
>
> C:\TestIMAP\LWitham\DynDNS.mbx
> C:\TestIMAP\LWitham\Drafts.mbx
> C:\TestIMAP\LWitham\Clarion.mbx
> C:\TestIMAP\LWitham\PaceIRC\Resource25.mbx
> C:\TestIMAP\LWitham\Trash\attached.mbx
>
> The problem occurs with filenames that contain embedded
>spaces or
> "special characters" (like "&" and "-" in the first record
>below):
>
> C:\TestIMAP\lsippel\FA Exec Staff\FA Safety &-
Security.mbx
> C:\TestIMAP\lsippel\FA Exec Staff\FA outmail NACUBO.mbx
> C:\TestIMAP\lsippel\FA Exec Staff\FA NACUBO Conferences
>Correspondence.mbx
> C:\TestIMAP\lsippel\FA Exec Staff\FA New Systems.mbx
> C:\TestIMAP\lsippel\FA Exec Staff\FA listserve junk
>mail.mbx
> C:\TestIMAP\lsippel\FA Exec Staff\FA Misc.mbx
> C:\TestIMAP\lsippel\FA Exec Staff\FA Faxes.mbx
> C:\TestIMAP\lsippel\FA Exec Staff\FA Facilities
>Management.mbx
>
> The program chokes on these filenames. My question is, is
>there a way,
> using FILEVAR to process multiple files, to get around this
>issue. I'm
> using FILEVAR because I have to have the counts by
filename,
>using
> another pipe would read the files as one continuous stream,
>I believe.
>
> Can the spaces and characters be escaped in some way to
make
>FILEVAR
> (and me) happy ? We have SAS v8 on this particular
>server, but do
> have v9 on workstations and test servers . This app will
be
>run on a
> Windows 2000 server.
>
> Any and all help will be much appreciated. Thank you.
>
> -Gerry
>
> Gerard T. Pauline
> Mgr, Internet Applications &
> University WebMaster
> Computer Systems, DoIT
> Pace University
|