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 (November 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 16 Nov 2004 10:31:04 -0600
Reply-To:     "Wall, Steven" <steve.wall@PIONEER.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Wall, Steven" <steve.wall@PIONEER.COM>
Subject:      List all files in a folder that meet name and date conditions
Content-Type: text/plain; charset="iso-8859-1"

SAS-L:

I have a macro (which probably came from SAS-L originally) that returns the names of all files in a given folder (PATH=) that match some naming convention I specify (FILE=). I'd like to modify to also have a date condition so, for example, I could ask it to give me all the *.SAS files in a folder that have been created since Jan 1, 2004. Ideally, this would be accomplished by adding a line or two to what I already have.

Current code is included below. Thanks for any advice you can give me.

SJ Wall

%MACRO GET_FILELIST(PATH=,FILE=,OUT=tmp.txt,DS=FILES);

proc datasets lib=work ; delete &DS ; run ;

filename dir "&path" ; data &DS ; length file $100 ;

did = dopen('dir') ;

do I = 1 to dnum(did) ; file = dread(did,i) ; if (index(file,"&file") > 0) then output ; fid = mopen(did,file) ;

if fid then do ; rc=fclose(fid) ; end ; end ;

rc = dclose(did) ;

keep file ; run ;

data _null_ ; set &DS ;

file "&out" ; put file ; run ;

%MEND GET_FILELIST;

This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties.

Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean

http://www.DuPont.com/corp/email_disclaimer.html


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