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 (January 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 9 Jan 2009 08:44:12 -0500
Reply-To:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:   Re: CSV files

Depends on the OS you are working with and of the file format. If you are working on zOS with VSAM files, you can get the information you are looking for. In win it is impossible. If you want to get the "number of records", there has to be a kind of header file which contain that information. VSAM clusters and all DBs are working with different kinds of such structure informations. In win a sequential file is simple a collection of bytes with many control-chars to mark "end-of-record", "end- of-file" and more. If you want to get the number of records, you simple count the "end-of-record" chars and you have it. There is no other possibility. For sure you can control, which records you want to write to a SAS dataset. So you read all records and check for "end-of-file". Only if that trigger is true, you OUTPUT the record.

filename xxx "c:\daten\test.dat";

data last_record; infile xxx truncover end=eof; input line $120.; if eof then do; call symput("n_of_records",_n_); output; end; run;

%put &n_of_records = number of records;

Gerhard

On Fri, 9 Jan 2009 13:19:41 +0100, yom <yomsas@GMAIL.COM> wrote:

>Dear all, > >Do you know if it is possible to get the number of lines of a csv file (or >text file) without creating the whole sas table. >I would like to create a sas table with only one observation whose values >are those of the last line of this csv file. Do you know a quick method ? > >Thank you very much in advance. >yom


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