For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Extending JMP > Work with SAS > Get the Values of SAS Macro Variables
Publication date: 11/10/2021

Get the Values of SAS Macro Variables

JMP provides several methods for querying SAS macro variables.

To show the systime value:

systime = sas << Get Macro Var("SYSTIME");
show(systime);

To show the defined SAS macro variables:

macro_names = sas << Get Macro Var Names();
show(macro_names);

To iterate through the SAS macro variables and print out the values:

macro_names = sas << Get Macro Var Names();
For( i = 1, i <= N Items( macro_names ), i++,
	macro_value = sas << Get Macro Var( macro_names[i] );
	output = macro_names[i] || " " || Char( macro_value );
	Show( output );
);

To submit SAS code that defines “test” as a SAS macro variable and then gets the value from SAS:

sas << Submit( "%let test = 1;" );
test = sas << Get Macro Var( "test" );
Show( test );

All macro variable values will evaluate to numbers, if possible, otherwise they will be characters.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).