LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2005, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 30 Jun 2005 10:40:14 -0700
Reply-To:     cassell.david@EPAMAIL.EPA.GOV
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject:      Re: File is already open.Error in the FILENAME statement.
In-Reply-To:  <1120095236.056252.125570@z14g2000cwz.googlegroups.com>
Content-type: text/plain; charset=US-ASCII

Demi <demi_yugov@YAHOO.CO.UK> wrote: > In Win 2000 SAS Version 8.2 batch mode I am using code like: > > goptions gsfname=gsasfile > noprompt > gsfmode=replace;

Hmmm. Does this mean that you are writing over the previous graph each time? How many times do you run the macro, and what do you do to save the separate graphics?

> %macro plotsmooth(score=, fgno= ); > > title1 h=2 j=l "Figure &fgno.: Smoothed daily &score. over time"; > filename gsasfile "F&fgno._&score..pdf"; > proc gplot; > plot &score*DiaryDay; > run; > %mend; > > %plotsmooth (score=cough, fgno=1.1); > %plotsmooth (score=volume, fgno=2.1); > > directly following a similar macro and macro call. > > I get: > > 213 %plotsmooth (score=cough, fgno=1.1); > ... > SYMBOLGEN: Macro variable FGNO resolves to 1.1 > SYMBOLGEN: Macro variable SCORE resolves to cough > MPRINT(PLOTSMOOTH): filename gsasfile "F1.1_cough.pdf"; > ERROR: File is already open. > ERROR: File is already open. > ERROR: File is already open. > ERROR: Error in the FILENAME statement. > ERROR: Error in the FILENAME statement. > ERROR: Error in the FILENAME statement. > > It seems the previous file associated with gsasfile hasn't had time to > close because my kludge solution is to add > > proc printto print='use_time.tmp' new; > run; > proc printto print=print; > run; > > to the end of the previous macro. Interesting that 10 sequential calls > of that macro OK, it is just using the second macro the first time one > that hurts. Subsequent calls of the 2nd macro OK too.

You are not explaining yourself well. What do you mean by "that macro" and "the second macro" and "10 sequential calls of that macro"? Are you saying that you have other macros calling this macro? The lack of detail is making it impossible to tell what the problem is.

Still, you would probably do a lot better using ODS instead of resorting to your kludge which might be the source of your problems.

> Or, if this occurs with ordinary code, I put a superfluous print stmt > in between the two groups of filename and gplot stmts. > > Is there a more elegant solution, e.g. a stmt to force the file closed? > FCLOSE(gsasfile) is no good though.

FCLOSE() is for use within a DATA step. I don't understand what you are doing. Again, more explanation would be helpful.

Perhaps it would help if you wrote a more careful explanation of your code and your problem, and replied to SAS-L (not to me personally), so that someone can provide better guidance.

> PS. Are 3 repeats of error msgs in logs a hangover from dot-matrix bold > printing? Can it be avoided?

Yes, you're seeing a holdover (and maybe a hangover too), but it is from old mainframe print-on-greenbar-paper days. Try:

OPTIONS NOOVP;

That's "NO OVerPrint". This is one of my favority options, because OVP is the default in so many places.

HTH, David -- David Cassell, CSC Cassell.David@epa.gov Senior computing specialist mathematical statistician


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