BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aayo
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
aayo
Obsidian | Level 7

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

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

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(...);

aayo
Obsidian | Level 7

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;

kelxxx
Quartz | Level 8

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.

aayo
Obsidian | Level 7

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2339 views
  • 0 likes
  • 3 in conversation