DATA Step, Macro, Functions and more

How to read input blank lines

Reply
N/A
Posts: 0

How to read input blank lines

Hi all,

I have a scenario wherein I am reading an external file using file reference. My file contains several input lines which are blank. But sas condenses multiple blank lines into a single blank line when I am writing it to a file of RECFM=FBA. But it works fine with RECFM=FB.

Please let me know how to overcome this problem.
Here is the piece of code I am using.

data _null_
infile 'test file' missover print truncover;
input @1 record $133;
file out1 notitle;
put @1 _infile_;
Super Contributor
Super Contributor
Posts: 3,174

Re: How to read input blank lines

Posted in reply to deleted_user
If you inspect the file, column 1 contains a print-control character for single, double-spacing. One technique to force a data line to be generated is to use a non-print character such as hex-00, as in:

PUT '00'X;

The caveat here is that you are asking for system-controlled line-skip and pagination print with the RECFM=FBA and the FILE stmt parameter PRINT, correct? The only alternative I can identify for you is to put something other than a blank line, as I have described above.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: How to read input blank lines

Thanks for the reply scott.

Can you please tell when to use PUT '00'X;

Do I need to use any check like if rec ' ' then PUT '00'X; Or what else?
Super Contributor
Super Contributor
Posts: 3,174

Re: How to read input blank lines

Posted in reply to deleted_user
Any type of check will depend on your SAS program and what you expect it to generate for output. If you simply want to generate extra blank lines and not have the system-generated line-control character, you would use the PUT statement without any checks. So, it will depend on your output requirements.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 3 replies
  • 133 views
  • 0 likes
  • 2 in conversation