- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How can I accomplish the following:
%put &q_start_date --> resolves to 01MAR2022
what I need the variable to resolve to is '01MAR2022'
Can anyone help me with the issue.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Better to apply the quotes when the macro variable is used, rather than include the quotes in the macro variable value. So when the macro variable is used, for example in a DATA step, you can do something like this
if date > "&q_start_date"d then ... ;
If that's not what you are looking for, please be more specific about how this macro variable will be used.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you can use double quotes (as you should be able to in normal SAS code) then just use:
%put "&q_start_date";
If you need the single quotes use %bquote().
%put %bquote('&q_start_date');
If the macro quoting added by %BQUOTE() causes trouble remove it.
%put %unquote(%bquote('&q_start_date'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How do you intend to use the macro variable? If you need it for comparisons or calculations, store the raw date value. See Maxim 28.