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.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: 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.

 

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 5409 views
  • 0 likes
  • 3 in conversation