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 (July 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 2 Jul 2003 10:50:28 +0200
Reply-To:     Ace <b.rogers@VIRGIN.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ace <b.rogers@VIRGIN.NET>
Subject:      Re: fopen() and infile correspondence
Content-Type: text/plain; charset=us-ascii

On Tue, 1 Jul 2003 20:40:51 +0000 (UTC), "Gleb V. Kotelnitsky" <kiz@pth.ntu-kpi.kiev.ua> wrote:

>I have a data step infile, input statements, which i want to convert to >fopen(),fread(),fget() functions. >the data statements are: > infile topics pad dsd notab dlm='09'x; > input topic $ @@; >when i try > %let topics=%sysfunc(fopen(&tref,s,,v)); > %sysfunc(fread(&topics)); > %sysfunc(fget(&topics,var)); >only the first record is read, after then fread() produces end of file >warning. >Is there a way of using functions to read such a file? (which is >filename(tref,excel|system!topics,dde) )

I'm assuming you've only given part of your code, particularly as you don't seem to be using sysfunc in an assignment, so the result (the return code) would then be interpreted as a SAS statement and give an error.

I've put some wrapping round your code and it works just fine. Maybe you're just missing part of it. Here's my code:

filename fred '.kshrc' ; %macro fred ; %let topics=%sysfunc(fopen(&tref,s,,v)); %do i = 1 %to 10 ; %let rc = %sysfunc(fread(&topics)); %let rc = %sysfunc(fget(&topics,var)); %put &var ; %end; %let rc = %sysfunc(close(&topics)) ; %mend ;

%let tref = fred ; %fred ; -- Ace in Basel - bruce dot rogers at roche dot com


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