BookmarkSubscribeRSS Feed
Quentin
Super User

@Froebel wrote:
I checked the length and it is bringing 1 for all three value , 1 , 2 and .

That would only happen if the value of the macro variable is a dot, rather than being blank.  In the macro language, a dot is a value.

ballardw
Super User

@Froebel wrote:
Thank you, I appreciate your response and I realize i should have provided more details. I have added the required code snippet, like you noted there is an error in the part where i am checking for null condition but what is it?

Part of the issue could well be where the macro variables Type and Minage are set. You do not show that anywhere.

 

Not sure what you are expecting for a result as there is no data accompanying the macro or the expected result. Adding the MINAGE added another syntax issue:

 AND TRUNC(months_between(orderdate, BIRTH_DATE) / 12) &minage.;

I don't find any documentation for a MONTHS_BETWEEN function in SAS. Is that some locally defined function (typically for such I would expect to see the INTCK function). And regardless the use of "And trunc(somevalue) &minage." will be a syntax error.

Suggestion: Turn on the option MPRINT as I showed above. Run your macro. Go to the log and copy the result of running your macro with all the MPINT notes. On the forum open a text box and paste that text. I strongly suspect you will see at least one if not more error messages.

You may have not been bothering to tell us about the errors you are receiving from the code because the default error messages shown after a macro runs are bit difficult to connect with specific statements. The MPRINT option will make the errors appear in closer proximity to the code causing them.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 16 replies
  • 7109 views
  • 1 like
  • 5 in conversation