Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetFileAttributes

Status
Not open for further replies.

NastyJohnson

Programmer
Feb 24, 2005
1
GB

Im looking to search a for a file that is downloaded everyday onto my server.
Im looking to check the date it was created and then import it into SAS. Ive been trying GetFileAttributes but can't get it to work. Can anyone help?
 
SAS has very poor tools for checking the creation date of a file. I see two ways of handling this problem.
A)
Have the file thats created on your server incorporate the date in its file name. Then, have your SAS program 'look' for the file of the day. This can be done via macro names etc...
This is only applicable if you have control over the whole process.

B)
On a windows system you can use the DIR command and read in the creation date via the PIPE option on the filename statement.
EX.
FILENAME test PIPE 'dir c:\directory_you_want ';

data t;
length cdate $20 ctime $10 ctype $10 size $20 filenm $400;
infile test missover;
input cdate $1-10 ctime $13-18 ctype $25-29 size $30-38 filenm $ ;
newdate = input(cdate,$mmddyy10.);
if today() eq newdate;
run;

This is just an example of what you need to do to look for a file that has todays date. There are a whole bunch of DOS options on that DIR command. You can open a DOS console screen and type DIR /? at the prompt to see most of the options.

I hope that this has helped you.
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top