Hello,
Please help.
I am trying to use macro for non-parametric test but I get warning below.
%let numgroups=9;
%let dataname=d;
%let obsvar=a;
%let group=B;
%let alpha=0.05;
title "Nonparametric test to examine the effect of B on a";
run;
/*invoke the KW_MC macro*/
%KW_MC(source=&dataname, groups=&numgroups, obsname=&obsvar, gpname=&group, sig=&alpha);
705 %KW_MC (source=&dataname, groups=&numgroups, obsname=&obsvar, gpname=&group, sig=&alpha);
-
180
WARNING: Apparent invocation of macro KW_MC not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order
my normal working code is
proc npar1way
data=d;
title "Nonparametric test to examine the effect of B on a";
class B;
var a;
run;
I finally pulled through. Below is my working macro code.
%macro KW_MC (obsvar,classvar,dataname,alpha);
proc npar1way
data=&dataname;
class &classvar;
var &obsvar;
run;
%mend;
/*invoke the KW_MC macro*/
%KW_MC(obsvar= x, classvar= y, dataname=a , alpha=0.05);
Macro KW_MC should be either compiled and saved in a SAS catalog or invoked
for compilation from a folder by:
%include <path and folder name>(KW_MC.sas);
You can use the macro only after compilation, by %KW_MC(...);
how do I go about it? Below is my working code.
proc npar1way
data=x;
title "Nonparametric test to examine the effect of B on A";
class B;
var A;
run;
Hi,
Can you verify your code %macro .. %mend;
because SAS don't know %KW_MC
I think that this macro is not successfully compiled
Have a nice day.
I finally pulled through. Below is my working macro code.
%macro KW_MC (obsvar,classvar,dataname,alpha);
proc npar1way
data=&dataname;
class &classvar;
var &obsvar;
run;
%mend;
/*invoke the KW_MC macro*/
%KW_MC(obsvar= x, classvar= y, dataname=a , alpha=0.05);
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.