Double quotes and compound quotes

Double quotes and compound quotes

* Double quotes and compound double quotes
local a "Germany"  
local b Germany
display "`a' `b'"			
/* Both locals are identical because double quotes at the end and beginning of a local's content 
are are omitted when the local is created. */

local c Germany is a country
local d Germany "is a" country  // This is different to c because the double quotes in the middle are preserved.
*display "`d'" 			// This results in an error message, because the expression expands to display "Germany "is a" country".
display `"`d'"'			// Compound double quotes solve the problem.

/* What's going on? " can be opening or closing quotation mark - it is not clear whether an 
old quote ends or a new, nested quote starts. If I write `" it is always an opening quotation mark 
and "' is always a closing quotation mark. */

* Advanced use of local notation
sysuse auto, clear
count   		
// Dataset contains 74 observations. We want to add 16 (empty) observations.
set obs `=_N + 16'  	
// _N contains the number of observations. Expression is first evaluated to 90 and then plugged into the command.