RESOLVE Function in SAS

The RESOLVE function is a SAS function that evaluates and resolves a macro variable reference in a character string.

The Resolve function takes a character string as an argument and evaluates any macro variable references within that string. It then replaces the macro variable reference with its resolved value. The result of the RESOLVE function is a character string with all the macro variable references resolved.

Suppose we have a macro variable called “city” with the value “New York”. We can use the RESOLVE function to evaluate and resolve the macro variable reference in a character string. For example, the following code:

%let city = New York;

data _null_;
put cityname=;

will produce the following output:

cityname=New York

As you can see, the variable cityname uses the RESOLVE function to resolve the macro variable reference in the character string.

Resolve function for macro invocation

This function is quite similar to the SYMGET function, but with the added ability to resolve macro names.

%macro procs;
proc print data=sashelp.class obs=3;
%mend procs;

data _null_;
 put var1=;
var1=proc print data=sashelp.class obs=3; run;

DATA step variable with a macro invocation

%macro procs;
proc print data=sashelp.class obs=3;
%mend procs;

data _null_;
length var2 $ 1000;
 put var2=;
var2=proc print data=sashelp.class obs=3; run;

The macro variable created using CALL SYMPUT is not available for use until the data step has been executed.

One notable advantage of using the RESOLVE function is that it allows users to create a macro variable using the SYMPUT routine and immediately resolve its value within the same data step.

You can create a macro variable with the SYMPUT routine and use RESOLVE to resolve it in the same DATA step.

DATA temp;
 CALL SYMPUT('res',var);
RESOLVE Function in SAS

If RESOLVE cannot locate the macro variable or macro identified by the argument, it returns the argument without resolution and the macro processor issues a warning message.


The RESOLVE function in SAS is a powerful tool that can help you resolve macro variables within a character string quickly and easily. This function is particularly useful when working with large amounts of code or text that contain macro variables. The RESOLVE function is efficient, flexible, and accurate, making it a valuable tool for SAS users.

Every week we'll send you SAS tips and in-depth tutorials



Subhro provides valuable and informative content on SAS, offering a comprehensive understanding of SAS concepts. We have been creating SAS tutorials since 2019, and 9to5sas has become one of the leading free SAS resources available on the internet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.