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 (August 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 23 Aug 2010 19:06:56 -0400
Reply-To:     Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject:      Re: Minor Macro Problem
Comments: To: "Data _null_," <iebupdte@gmail.com>
In-Reply-To:  <AANLkTimJ_882A70iPkEWcYgbF3dw_ejLN+bYPvkBtJE7@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Thank you Data _null_. This is indeed helpful.

On Mon, Aug 23, 2010 at 4:46 PM, Data _null_; <iebupdte@gmail.com> wrote:

> If you're seaching a tree for CSVs as I suspected this example may be > useful. It uses the power of the UNIX find command. With the printf > parameter you can format the output just about any way you like. If > never like trying to read the output of LS command. > > data files(keep=FilePath FileName EpochTime CharTime FileTime); > attrib command length=$256 label='Command executed via > PIPE access method'; > attrib startDir length=$128 label='[path...] operand for UNIX > find'; > attrib printF length=$64 label='-printf parameter for UNIX > find'; > attrib name length=$128 label='-name parameter for UNIX > find'; > attrib FilePath length=$256 label='filepath %h from UNIX find'; > attrib FileName length=$256 label='filename %f from UNIX find'; > attrib EpochTime length=8 label='UNIX time %T@ seconds > since 01Jan1970'; > attrib CharTime length=$32 label='Human readable time %t'; > attrib FileTime length=8 label='File time (GMT) in SAS > datetime format'; > printF = catx('\t','%h','%f','%T@','%t\n'); > startDir = '..'; > name = '*.csv'; > > command = catx(' > > ','/shared/gnu/bin/find',quote(strip(startDir)),'-name',quote(strip(name)),'-printf',quote(strip(printF))); > putlog 'NOTE: ' command=; > infile dummy pipe filevar=command end=eof truncover dsd dlm='09'x; > if eof then putlog 'WAR' 'NING: no files match the search'; > do _n_ = 1 by 1 while( not eof); > input FilePath Filename EpochTime CharTime; > FileTime = EpochTime + '01Jan1970:00:00:00'dt; > output; > end; > stop; > Format FileTime datetime18.; > run; > > On 8/23/10, Joe Whitehurst <joewhitehurst@gmail.com> wrote: > > Thanks for the tip! > > > > > > On Mon, Aug 23, 2010 at 10:02 AM, Data _null_; <iebupdte@gmail.com> > wrote: > > > > > > directory tree and then read them all with PROC IMPORT. > > > > > > > >


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