DATA Step, Macro, Functions and more

Macro Output not getting generated

Reply
Contributor
Posts: 65

Macro Output not getting generated

Hi,

I am using a SAS code which have macros within a macro. When I execute this, the output is not getting transferref to the .lst file(which contains the output of the print proc). All I get is an empty .lst file.

Please refer the code below:-

 

proc printto print="&protpath/outlist/program_d.lst"
              log  ="&protpath/outlog/program_d.log"   new;
run;
%macro program_d(callid=);
 
%put ;
%put -----------------------------------------------------------------------------;
%put --- Start of %upcase(&sysmacroname) macro                                    ;
%put ---   callid=&callid                                                         ;
%put -----------------------------------------------------------------------------;
%put ;
 
%local  report_name;
%let    report_name=&sysmacroname;
 
%*** Bring in global report macro parameters and perform other global functions. ****;
%infrastructure2(report=&report_name,callid=&callid);
%if &_err_flag=Y %then
%goto exit;
 


data class1; 
  set sashelp.class; 
run;

%macro meann(datain=);
	proc means data=&datain median min max ;
	  by sex;
	  var Age Height Weight ;
	run;

	proc print data=&datain;
	title "Is datain in the list file";
	run;
	
%mend meann;

%meann(datain=class1);
 
%rtfsymbl(groups=_ALL_);
%exit:
%if "&debug"="N" %then %wrapup;
%put;
%put ---End of %upcase(&sysmacroname) macro;
%put;
%mend program_d;
%program_d(callid=001);
proc printto;
run;
Super User
Posts: 9,682

Re: Macro Output not getting generated

options source source2 mprint mlogic symbolgen;
Contributor
Posts: 65

Re: Macro Output not getting generated

[ Edited ]

@Ksharp: Could you please explain that?

Super User
Super User
Posts: 7,407

Re: Macro Output not getting generated

What @Ksharp meant is turn on the debug options.  These print the values of macro variables, what the macro code evaluates to.  From what you have posted there is no way we can provide any answers.  There are various other macro calls within that code, and other macro variables.  We do not know what these do, represent, or contain.  This comes under the heading of obfuscation.  Why do you need to have a macro, which all it does it proc means, and lists the output?  Use base SAS code, everyone will understand it then.

Contributor
Posts: 65

Re: Macro Output not getting generated

@RW9: Yeah I'll do that. Thanks for making the point clear.
Ask a Question
Discussion stats
  • 4 replies
  • 194 views
  • 0 likes
  • 3 in conversation