Date: Fri, 29 Jul 2005 14:57:37 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: Successively reading any new file present in the folder
In-Reply-To: <MC4-F351ndcx3Vp20N30036910e@mc4-f35.hotmail.com>
Content-Type: text/plain; format=flowed
nnkulkarni@GMAIL.COM wrote:
>I want to write a macro which:
>
>1. Successively reads any new file present in the folder. This input
>folder can be C:\temp\sasdata.
>
>2. The macro should delete the files(these can be csv or sas dataset
>files) which are present in the folder C:\temp\sasdata after the use or
>after the sas dataset is being created out of these files.
>
>3.Should support some error handling like - If there are any errors
>while creating the sas dataset out of the imported (csv.sas files) file
>the affected files should be copied into another folder say
>C:\temp\error, and also relevant entries to the above should be added
>to the log file.
>
>Any help is highly appreciated. If a sample code/macro is readily
>available it will save a lot of time and efforts.
[1] I don't think you should start out trying to do this in a macro.
Work without any macro programming at first. Look up the
features for handling wildcards and multiple input files that are in the
DATA step. You may not need more than a single DATA step to
read in al lyour files and generate a list of the file names.
[2] Don't think in terms of SAS when you're doing system admin
tasks. If you want this level of error-handling, then you'd better
think about doing the file creation/deletion/moving in a sysadmin's
language, like Perl. After all, how can you move a file if you can't
touch it? If you fail to read it, it's likely to be much harder to
delete it or move it or whatever. (Think about the privileges
involved for these tasks.)
[3] It's really not fair to ask SAS-L to do all this work for you unless
you're willing to do some of it first. Write some code to do each
of the tasks. Test it out and debug it. Then show us and ask
for pointers in improving it. We can at least see what the underlying
specs are for your tasks.
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/