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 (September 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 3 Sep 2004 12:33:17 -0500
Reply-To:   "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Subject:   Re: "No logical assign for filename" Error
Comments:   To: Helen <sunchunkui@HOTMAIL.COM>
Content-Type:   text/plain; charset="us-ascii"

Helen,

You might want to consider turning on symbolgen to see what your macro vars are resolving too and when, thus helping you find the problem more easily.

Toby Dunn

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Helen Sent: Friday, September 03, 2004 11:43 AM To: SAS-L@LISTSERV.UGA.EDU Subject: "No logical assign for filename" Error

Dear SAS-l,

I am trying to get the lastest Excel filename according to modified date under a certain directory. It works well without macro. But it gave me error message "No logical assign for filename " in the following macro. Any comments?

Thanks! Helen

1 2 %macro GetLatestFileName(dir); 3 filename xlfile pipe "dir ""&dir""" lrecl=200; 4 data in; 5 infile xlfile length=len; 6 input char $varying200. len; 7 8 retain lastestname lastestdate ; 9 date=input(substr(char,1,10),mmddyy10.); 10 name=scan(char,4,' '); 11 if _n_=1 then do; lastestname=name; lastestdate=date; end; 12 if date>lastestdate then do;lastestname=name; lastestdate=date; end; 13 call symput("fname",trim(lastestname)); 14 run; 15 filename xlfile clear; 16 &fname; 17 %mend; 18 19 options mprint; 20 %let test=%GetLatestFileName(c:\temp\*.xls); MPRINT(GETLATESTFILENAME): data in; MPRINT(GETLATESTFILENAME): infile xlfile length=len; MPRINT(GETLATESTFILENAME): input char $varying200. len; MPRINT(GETLATESTFILENAME): retain lastestname lastestdate ; MPRINT(GETLATESTFILENAME): date=input(substr(char,1,10),mmddyy10.); MPRINT(GETLATESTFILENAME): name=scan(char,4,' '); MPRINT(GETLATESTFILENAME): if _n_=1 then do; MPRINT(GETLATESTFILENAME): lastestname=name; MPRINT(GETLATESTFILENAME): lastestdate=date; MPRINT(GETLATESTFILENAME): end; MPRINT(GETLATESTFILENAME): if date>lastestdate then do; MPRINT(GETLATESTFILENAME): lastestname=name; MPRINT(GETLATESTFILENAME): lastestdate=date; MPRINT(GETLATESTFILENAME): end; MPRINT(GETLATESTFILENAME): call symput("fname",trim(lastestname)); MPRINT(GETLATESTFILENAME): run;

ERROR: No logical assign for filename XLFILE. ERROR: No logical assign for filename XLFILE. ERROR: No logical assign for filename XLFILE. NOTE: The SAS System stopped processing this step because of errors. NOTE: SAS set option OBS=0 and will continue to check statements. ......


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