Begin the DATA step.
input text $40.;
When using nested functions, start inside and work your way out. The inner most
function is QUOTE. It is used to add double quotation marks to the character value
contained within the variable TEXT. The RESOLVE function is used to resolve the
value of a text expression during the DATA step execution. In this case, the RESOLVE
function returns the value of the DATA step variable TEXT. The DEQUOTE function
removes matching quotation marks from a character string that begins with a quotation
mark. Then the DEQUOTE function deletes all characters to the right of the closing
quotation mark. The final value is assigned to the variable named TEXTRESOLVED.
Use the DATALINES statement to create the data.
My &dog is a female
That's Amy's &dog puppy
Use PROC PRINT to display the results.
Obs text textresolved
1 John's &dog John's Golden Retriever
2 My &dog is a female My Golden Retriever is a female
3 That's Amy's &dog puppy That's Amy's Golden Retriever puppy
Example 13: Print Information to the Output
Window If a Data Set Is Empty
This macro uses the PRINT procedure to print a data set if it contains observations. If
there are no observations, then a DATA _NULL_ step is used to write a message to the
470 Appendix 5 • SAS Macro Examples