Thank you so much!
I don't understand what your current code is doing. Why are you opening a dataset using macro code?
Why are you generating multiple datasets?
If you want to find observations where the last three characters are in a list of values just use:
where substrn(product_id,length(product_id)-2) in ('889' '123')
The SAS macro processor is a way to allow you to generate CODE.
So what SAS code do you want to run?
What type of variable is PRODUCT_ID?
If it is a character variable then something like:
where product_id like '%889'
should work.
If it is numeric then you want to do something like:
where mod(product_id,1000) = 889
What output do you want? What is the overall code you are trying to create?
Why did you mention macro? Is there some part of the code that needs to change so that you want to use a macro or perhaps just a macro variable to generate that part of the code? How does it change? What are the types of values that you will need to support? How do the different values change how the SAS code you need to run looks?
Thanks!
Is that a typo or is that what you expect to match?
@nancy_mancilla wrote:
Value to look up
8885
Value expected
1274885
8841885
thanks!
I don't understand what your current code is doing. Why are you opening a dataset using macro code?
Why are you generating multiple datasets?
If you want to find observations where the last three characters are in a list of values just use:
where substrn(product_id,length(product_id)-2) in ('889' '123')
Thank you so much!
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!
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.