On 16 Jun, 09:51, abose <hira...@gmail.com> wrote:
> Is there any foolproof way to output the text generated by any macro
> to a file (using data _null_ and put may be)?
> The reason I ask:
> Where I work, it is a mainframe system. I can put JCL and SAS commands
> to a special file, to create a new job. I would like to have some
> macro which can create new jobs. Example, I would want to have a macro
> %Fork which can create a new job, taking the argument as a macro which
> generates SAS code:
> %Macro Process(parameter);
> ...whatever the job should do...
You can write the output of a sas macro to an external file using the
'mfile mprint' option.
/* issue the options statement */
options mfile mprint;
/* Allocate a filename to recieve the macro output */
filename mprint 'aaaa.bbbb.cccc.ddd(xxxx)';
/* Run your macros */
Filename mprint clear;
The code generated by the macro swill be placed in the file allocated
as mprint. It will be available at the end of you SAS session for
debugging. From a JCL submitted job it is available at the end of the
I hope that this might be of some help.