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;
options source source2 mprint mlogic symbolgen;
@Ksharp: Could you please explain that?
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.