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 (April 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 14 Apr 2010 20:52:38 -0500
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: Get external file last modified date and time regardless of
              regional settings
Comments: To: Scott Bass <sas_l_739@yahoo.com.au>
In-Reply-To:  <201004150137.o3EJ7McB024730@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

http://www.devenezia.com/downloads/sas/sascbtbl/

Maybe Mr. DeVenezia's example will provide a more direct route to the data you seek and relieve the burden of regional setting.

On 4/14/10, Scott Bass <sas_l_739@yahoo.com.au> wrote: > Hi, > > This is more a Windows question, but here goes... > > I need to get a directory list, including the last modification date ***in a > format independent of the regional settings***. > > For example, my regional settings for date is dd-MMM-yy and time is HH:mm:ss > (24 hour time). > > So a sample directory list is: > > Directory of c:\temp > > 25-Mar-10 13:22 100 temp.sas > > which is likely different than your machine, esp. if you're in the US. > > I need the last modified date/time of the file, and have confidence that my > code will get the correct results no matter the regional setting of the end > users machine. > > I'm aware of the anydt* formats - perhaps these will work? But I'd have to > try them with every combination of regional date settings. And while the > date settings are pre-populated with a dropdown list, it looks like I can > overtype them to set my own settings. > > Alternatively, are there any undocumented switches to dir that would format > the date/time of files consistently? > > Finally, if any birdies are listening, here is a modified code snippet > straight from the FINFO function: > > data info; > length infoname infoval $60; > drop rc fid infonum i close; > rc=filename('abc','c:\autoexec.bat'); > fid=fopen('abc'); > infonum=foptnum(fid); > do i=1 to infonum; > infoname=foptname(fid,i); > infoval=finfo(fid,infoname); > output; > end; > close=fclose(fid); > run; > > This gives me the oh-so-unhelpful list of filename, recfm, and lrecl. C'mon > SAS, you're up to v9.2. How about a few more external file attributes so I > can get this information portably, without exiting to the O/S? > > Here would be a good list to start with: > > In addition, substitution of FOR variable references has been enhanced. > You can now use the following optional syntax: > > %~I - expands %I removing any surrounding quotes (") > %~fI - expands %I to a fully qualified path name > %~dI - expands %I to a drive letter only > %~pI - expands %I to a path only > %~nI - expands %I to a file name only > %~xI - expands %I to a file extension only > %~sI - expanded path contains short names only > %~aI - expands %I to file attributes of file > %~tI - expands %I to date/time of file > %~zI - expands %I to size of file > %~$PATH:I - searches the directories listed in the PATH > environment variable and expands %I to the > fully qualified name of the first one found. > If the environment variable name is not > defined or the file is not found by the > search, then this modifier expands to the > empty string > > The modifiers can be combined to get compound results: > > %~dpI - expands %I to a drive letter and path only > %~nxI - expands %I to a file name and extension only > %~fsI - expands %I to a full path name with short names only > %~dp$PATH:I - searches the directories listed in the PATH > environment variable for %I and expands to the > drive letter and path of the first one found. > %~ftzaI - expands %I to a DIR like output line > > > Thanks for any ideas you can provide... > > Regards, > Scott >


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