filename sample1 'L\Common\new1.txt';
filename fixed 'L\Common\new2.txt';
data _null_;
retain maxp 8 p 0;
infile sample1;
file fixed lrecl=4000;
input ;
if p then put ' ' @;
put _infile_ @;
p+countc(_infile_,'#');
if p>= maxp then do ;
put ;
p=0;
end;
run;
I am running above code aand I have used LRECL=4000 to write into a text file
But when i see the log maximum record length is 1473
NOTE: 16767 records were read from the infile SAMPLE1.
The minimum record length was 1.
The maximum record length was 200.
NOTE: 1596 records were written to the file FIXED.
The minimum record length was 125.
The maximum record length was 1473.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.03 seconds
how can i increase the record length
The answer likely lies in your data. The log tells you that the minimum record length being read is 1 character long. This tells me that you have some lines of data that contain just #. They won't take up very much space, but they will add to your calculated value for P. So it's either time to correct the data, or it's time to reformulate how you calculate when another line will fit onto the current line. SAS contains plenty of tools to do this, such as an option on the FILE statement to track your current position on the line.
Why would you want to increase the logical record length if it is already more than twice as long as you need for your actual data?
Or is there some other question that you are trying to ask?
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.