As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Difference between revisions of "Quotes within Quotes: When Single (‘) and Double (“) Quotes are not Enough"

From sasCommunity
Jump to: navigation, search
m (gardening)
(added category)
Line 18: Line 18:
[[Category:Macro Language]]
[[Category:Macro Language]]
[[Category:DATA Step]]
[[Category:DATA Step]]
[[Category:PharmaSUG 2014]]
[[Category:WUSS 2015]]
[[Category:MWSUG 2017]]

Latest revision as of 00:54, 28 October 2017


Although it does not happen every day, it is not unusual to need to place a quoted string within another quoted string. Fortunately SAS® recognizes both single and double quote marks and either can be used to within the other. This gives us the ability to have two deep quoting. There are situations, however where two kinds of quotes are not enough. Sometimes we need a third layer or more commonly we need to use a macro variable within the layers of quotes. Macro variables can be especially problematic as they will generally not resolve when they are inside single quotes. However this is SAS, and that implies that there are several things going on at once and that there are several ways to solve these types of quoting problems.

The primary goal of this paper is to assist the programmer with solutions to the quotes within quotes problem with special emphasis on the presence of macro variables. The various techniques are contrasted as are the likely situations that call for these types of solutions. A secondary goal is to help the reader understand how SAS works with quote marks and how it handles quoted strings. Although we will not go into the gory details, a surface understanding can be useful in a number of situations.

Online Materials

View the pdf for this paper.

Contact Info

Please check out my user page. You can also email me.