Scripting Guide > Extending JMP > Work with SAS > Get the Values of SAS Macro Variables
发布日期: 04/13/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.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).