SAS + to find thr number of length in a variable record
Posted:
Thu Jan 21, 2010 11:54 am
by mainframe1
Hi,
how to find the lenght of each record for variable file
say
123445678
123467
1234
i want th record count and byte count for this variable length file in SAS.pls help
Re: SAS + to find thr number of length in a variable record
Posted:
Thu Jan 21, 2010 6:29 pm
by Robert Sample
DATA A;
INFILE ???????? LENGTH=RL;
INPUT @;
RECLEN = RL ;
LENGTH DATALINE $ 32760;
INPUT @001 DATALINE $VARYING. RECLEN ;
Getting the record count is trivial using the END option of INFILE.
Re: SAS + to find thr number of length in a variable record
Posted:
Mon Mar 15, 2010 3:53 pm
by heronfisher
variable labels to files;
do i=1 to n;
labpos=pos(i)+floor((lens(i)-
length(left(varlabel(dsid,i))))/2);
rc=fpos(fid1,labpos);rc=fpos(fid2,labpos);
rc=fput(fid1, varlabel(dsid,i));
rc=fput(fid2, varlabel(dsid,i));
end;
rc=fwrite(fid1,’0’); rc=fwrite(fid2,’0’);
do i=1 to n;
rc=fpos(fid1,pos(i));rc=fpos(fid2,pos(i));
rc=fput(fid1, repeat(’-’,lens(i)-1));
rc=fput(fid2, repeat(’-’,lens(i)-1));
end;
rc=fappend(fid1); rc=fappend(fid2);