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 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 5 Sep 2000 20:41:15 GMT
Reply-To:     sashole@mediaone.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject:      Re: FW: Creating a file IF....
Comments: To: James.Kerrison@FMR.COM
Content-Type: text/plain; format=flowed

Foster,

Ian is of course right. However, Howard's solution does not need an existing fileref (I think I mentioned it in my 'ditto' reply to Howard's post, but am not quite sure). In this variant,

data _null_; retain fname "c:\sastest.txt"; set dataset; file smth filevar=fname; if _n_=1 then put @01 "TITLE"; put @1 var1 comma10.; run;

SMTH is merely a dummy name, not associated with any already assigned fileref. It *does* work in 8.1. (Actually, despite the tech note, Howard's variant where the fileref had already been assigned, worked too, but since the tech note raises a flag, I would comply.)

Kind regards, =================== Paul M. Dorfman Jacksonville, Fl ===================

>From: "Kerrison, James" <James.Kerrison@FMR.COM> >Reply-To: "Kerrison, James" <James.Kerrison@FMR.COM> >To: SAS-L@LISTSERV.UGA.EDU >Subject: FW: Creating a file IF.... >Date: Tue, 5 Sep 2000 16:03:37 -0400 > >Thanks Ian, > >FYI for anyone who clipped Howard's code, and is in V8. > >"Howard's solution works in 6.12, but V8 has tightened up the code so that >one should not use an existing fileref with the FILEVAR option. See > >SN-001168 >Do not use existing fileref with FILEVAR= on INFILE " > >-----Original Message----- >From: Ian Whitlock [mailto:WHITLOI1@WESTAT.com] >Sent: Tuesday, September 05, 2000 3:33 PM >To: 'Kerrison, James' >Subject: RE: Creating a file IF.... > > >James, > >FILE is both executable and compile time directive. As a compile time >directive a buffer is set up and the old file wiped out (unconditionaly >when >the code is read). As an executable the buffer pointer is changed when the >IF statement is true. However, for an empty dataset, execution stops >on the SET statement. Howard's solution works in 6.12, but V8 has >tightened >up the code so that >one should not use an existing fileref with the FILEVAR option. See > > SN-001168 >Do not use existing fileref with FILEVAR= on INFILE > >Ian Whitlock <whitloi1@westat.com> > >-----Original Message----- >From: Kerrison, James [mailto:James.Kerrison@FMR.COM] >Sent: Monday, August 28, 2000 11:31 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Creating a file IF.... > > >This seems like a simple enough step, but I can't get it right. I am trying >to create a file IF there is data in a dataset. > >My code looks something like this: > >data _null_ ; > set dataset; > >if _n_ = 1 then do ; >file "filexxx.txt"; > >Put @ 01 "TITLE " .......; > >end ; > >put @ 01 Var1 comma10. ....; > >run ; > >I am assuming that if the dataset is null that the if statement will >evaluate to 0, and nothing will happen. However the file is still being >created even though there is no data in the dataset being set! Any ideas or >pointers would be appreciated. > >TIA, > >Foster Kerrison

_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at http://profiles.msn.com.


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