Hi, I am looking for a macro which needs to do some tasks as mentioned below.
It should create dummy variables like we have "Dummies" package in R which will create dummy variables for all categorical variables based on some conditions like in some variables we have categories like more than 20 or 30 etc. and for those type of variables it should skip and drop original variables after creating dummy variables....
If anyone have this macro, please share with us...
Thanks in advance.
I don't know R ... maybe posting what you have and what you want as datasets will make it easier to help you. And also post the code you have already written to solve your problem.
In SAS you probably want to use a CLASS-statement. It handles categorical data for proc reg, logistic, glm ..
And note that R and SAS are 2 different programming languages. In SAS you can add those statements either to a proc, or you need a data-step to create them yourself.
This such a simple task that a macro would be overkill, both in terms of writing and in terms of using it.
And what have you done? As in your previous posts, this is not a contract work request forum, it is a Q&A forum. If you have specific questions, then pose the question using descriptive text, with example test data in the form of a datastep, and what you want to see out. Post code that you have tried, and logs of any errors/warnings.
@dsp1 wrote:
Hi, I am looking for a macro which needs to do some tasks as mentioned below.
It should create dummy variables like we have "Dummies" package in R which will create dummy variables for all categorical variables based on some conditions like in some variables we have categories like more than 20 or 30 etc. and for those type of variables it should skip and drop original variables after creating dummy variables....
If anyone have this macro, please share with us...
Thanks in advance.
Hey @dsp1 you could save yourself a lot of time by just doing searches here in this forum or in Google.
Here is a long thread that covers lots of good information about creating dummy variables.
Note that SAS will do this automatically in some PROCS via the CLASS statement, otherwise, I find this covers most ways to create dummy variables:
There are a multitude of ways to do this.
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 16. Read more here about why you should contribute and what is in it for you!
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.