BookmarkSubscribeRSS Feed
sknguru
Calcite | Level 5

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.

Thanks,

Selva

5 REPLIES 5
hdodson_pacificmetrics_com
Calcite | Level 5

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.

Sorry/Thanks,

Huey

Cynthia_sas
SAS Super FREQ


Hi:

  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.

cynthia

Tom
Super User Tom
Super User

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_;

run;

sknguru
Calcite | Level 5

Tom,

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.

data_null__
Jade | Level 19

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;
  
input;
  
if _n_ eq 1 or eov then do;
     
file=filename;
      eov=0;
      fileline1=
1;
      outfile = catx(
'/',pathname('FT60F001'),scan(file,-1,'/'));
      putlog file= / outfile=;
      end;
  
select;
     
when(fileline1)                _infile_ = '1'||_infile_;
      when(first(_infile_) eq '0C'x) substr(_infile_,1,1)='1';
     
otherwise                      _infile_ = ' '||_infile_;
      end;
  
file dummy filevar=outfile lrecl=512;
  
put _infile_;
  
return;
eof:
stop;
  
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1313 views
  • 3 likes
  • 5 in conversation