LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 24 Jun 2005 14:55:57 -0400
Reply-To:     harry.droogendyk@RBC.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Harry Droogendyk <harry.droogendyk@RBC.COM>
Subject:      Re: Conditional Import based on most recently created file
Content-Type: text/plain; charset="iso-8859-1"

and if you add the /b switch to the /o-d, the header stuff will be omitted and you'll get just the filenames in reverse chronological order

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]On Behalf Of cassell.david@epamail.epa.gov Sent: Friday, June 24, 2005 2:54 PM To: owner-sas-l@listserv.uga.edu Cc: SAS-L@LISTSERV.UGA.EDU Subject: Re: Conditional Import based on most recently created file

"Bonett, John" <jbonett@ETS.ORG> wrote: > I work in a Windows NT environment, SAS V9.1.3. If I have a folder > containing versioned Excel 2000 conversion tables of slighlty different > naming conventions and only want to import the latest file (most recently > created). Is there an easy way to do that? Thank you in advance!

'easy' is relative here.

You're going to have to go outside SAS to get the date info on the files. One suggestion given recently in SAS-L is to use the DIR function in a pipe so it can be read in a DATA step. You then end up parsing the DIR output to get the latest-touched Excel file. Saving that name in a macro variable would let you run PROC IMPORT with the information you want. (I personally would do the directory read in a Perl program, but that's just me.) If you use a FILENAME statement like this:

filename dirlist pipe "dir /o-d *.xls";

then you can read DIRLIST into a DATA step. And the desired filename ought to be in line 5, right after the header junk.

HTH, David -- David Cassell, CSC Cassell.David@epa.gov Senior computing specialist mathematical statistician __________________________________________________________________________________________________________________________________

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.


Back to: Top of message | Previous page | Main SAS-L page