BookmarkSubscribeRSS Feed
V168
Calcite | Level 5
761  %let smote_version=2.0;
762  %smote(data=Project1.Default_credit, /* Your dataset name */
     -
     180
WARNING: Apparent invocation of macro SMOTE not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
763         target=default_payment_next_month, /* Your target variable name */
764         nneighbors=5, /* Number of neighbors for SMOTE */
765         relfreq=1, /* Relative frequency of minority to majority class */
766         out=OversampledData);

I want help for use smote macro to handle imbalancing target data whie build the logistic regression model.  When I code this, it gives me error, some suggestions is to find out the path to the macro definition in your SAS environment and put in my code, but I don't know how. Can anyone give me help?

761  %let smote_version=2.0;
762  %smote(data=Project1.Default_credit, /* Your dataset name */
     -
     180
WARNING: Apparent invocation of macro SMOTE not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
763         target=default_payment_next_month, /* Your target variable name */
764         nneighbors=5, /* Number of neighbors for SMOTE */
765         relfreq=1, /* Relative frequency of minority to majority class */
766         out=OversampledData);
8 REPLIES 8
Quentin
Super User

Do you have the SAS code that defines the macro %smote?

 

It will look like:

%macro smote(data=);
  *more code here;
%mend smote;

If not, you'll have to find that code.  If you learned of this macro by reading a paper, sometimes people put the code as an attachment to the paper, or on github, or elsewhere.  Or if this is a macro commonly used within your company, you can ask your colleagues for help on compiling the macro to make it available.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
V168
Calcite | Level 5

%smote(data=Project1.Default_credit, /* Your dataset name */
target=default_payment_next_month, /* Your target variable name */
nneighbors=5, /* Number of neighbors for SMOTE */
relfreq=1, /* Relative frequency of minority to majority class */
out=OversampledData); /* Output dataset with oversampled data */

PaigeMiller
Diamond | Level 26

@V168 wrote:

%smote(data=Project1.Default_credit, /* Your dataset name */
target=default_payment_next_month, /* Your target variable name */
nneighbors=5, /* Number of neighbors for SMOTE */
relfreq=1, /* Relative frequency of minority to majority class */
out=OversampledData); /* Output dataset with oversampled data */


This is not what @Quentin and I are referring to. This code CALLS the macro. But this won't work unless you first DEFINE the macro to your program by %including (or pasting) the macro code into your program. You have not done this. 

--
Paige Miller
PaigeMiller
Diamond | Level 26

Any macro must be defined and made available to your SAS program, before it can be used. You have not done this.

 

Probably you need to download the macro to your computer first. Then you need a %include statement to include the macro from the downloaded file before calling it (or you need to paste the macro code in your program before calling it)

--
Paige Miller
V168
Calcite | Level 5

How to download or how to check if I have?

PaigeMiller
Diamond | Level 26

@V168 wrote:

How to download or how to check if I have?


Did you go to some internet web site where the SMOTE macro is available and download it to your computer?

--
Paige Miller
V168
Calcite | Level 5

I will try, thanks!

Quentin
Super User

The code you posted is an example of using the macro.

 

Probably your best chance is to ask the person who wrote that code where you can find the code that creates the macro. I googled a bit, I don't see any papers that mention %smote.  So it's probably a macro created by one person, used internally within your company.

 

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 5847 views
  • 0 likes
  • 3 in conversation