The SAS Output Delivery System and reporting techniques

SAS output with ASA Control Characters

New Contributor
Posts: 4

SAS output with ASA Control Characters

We have a process that requires us to capture the SAS PROC output in plain text format with the page break and line break translated to the appropriate ASA control characters.

The current process creates a regular output and we have a script (perl) that adds '1' for every new page and ' ' for every new line in the first column. This deletes any existing value in column one.  There are hundreds of reports and they designed it to fill the whole length of the page. Is there a way we can force the PROC output to skip the first position with some option, instead of changing every reports.



Posts: 22

Re: SAS output with ASA Control Characters

Howdy sknguru,

     Could you provide a small piece of code that would help communicate the situation a little better?

     Helpful information would be:

          1) Types of PROC(s) you're using.

          2) Which ODS destination you're using

          3) Sample output before & after the PERL script runs.



Posts: 9,371

Re: SAS output with ASA Control Characters


  Your "ASA" control characters sound exactly like the carriage control characters we used to write to the mainframe. Generally, if you define or allocate the DCB of your  SYSOUT to be FBA or VBA, I thought that the system reserved the first column for the carriage control characters automatically. I guess I don't know why you need a PERL script to insert carriage control characters unless you are trying to replicate on UNIX the kind of mainframe printer output that you can get on the mainframe automatically.

  So you are probably not using ODS at all, but instead want to get the LISTING output. I believe you might want to look into the FORMDLIM option but in my mind, it's a question for Tech Support how to get the carriage control characters in a non-mainframe output file.


Super User
Super User
Posts: 8,117

Re: SAS output with ASA Control Characters

Just fix your PERL program.  Or write one in SAS instead.

data _null_;

   infile old ;

   file new ;

   input ;

   if index(_infile_,'0C'x) then _infile_='1'||compress(_infile_,'0C'x);

   else _infile_='  '||_infile_;

   put _infile_;


New Contributor
Posts: 4

Re: SAS output with ASA Control Characters


Thanks. We did modify the perl script to do exactly what you have provided (adding the control character to the line, instead of replacing the first character). We probably will go with this approach. The team is just evaluating if there is any impact at the end of the line.

Respected Advisor
Posts: 3,852

Re: SAS output with ASA Control Characters

If you take Tom's program and modify it slightly you can get all the .LST files in a directory rewritten with FORTRAN CC.  With regards to end of the line.  LRECL=512 should be long enough for any .LST but you can increase if you like.

The FILELINE1 variable indicates first line of a file which on my system has no '0C'x but I add CC '1'  you may or may not want to do this I don't know.

filename FT59F001 './*.lst';
filename FT60F001 './CC';

data _null_;
length outfile file filename $256;
infile FT59F001 eof=eof eov=eov filename=filename lrecl=512;
if _n_ eq 1 or eov then do;
      outfile = catx(
      putlog file= / outfile=;
when(fileline1)                _infile_ = '1'||_infile_;
      when(first(_infile_) eq '0C'x) substr(_infile_,1,1)='1';
otherwise                      _infile_ = ' '||_infile_;
file dummy filevar=outfile lrecl=512;
put _infile_;

Ask a Question
Discussion stats
  • 5 replies
  • 5 in conversation