Chapter Contents

Previous

Next
SYMGET and SYMGETN

SYMGET and SYMGETN



Return the value stored in a macro variable

Category: Macro


Syntax
Details
Examples
Example 1: Using the SYMGET Function
Example 2: Using the SYMGETN Function
Example 3: Returning Macro Values at Program Compile Time
See Also

Syntax

cval=SYMGET(macro-var);
nval=SYMGETN(macro-var);

cval
contains the character value returned by SYMGET.

Type: Character

nval
contains the numeric value returned by SYMGETN.

Type: Numeric

macro-var
is the macro variable.

Type: Character


Details

SYMGET and SYMGETN return values of macro variables when the program executes, whereas "&macro-var" returns values when the program compiles. SYMGET returns the value of a SAS macro variable as a character value and SYMGETN returns the value as a numeric value.


Examples

Example 1: Using the SYMGET Function

Execute commands if the operating system is Windows:

if symget('SYSSCP') = 'WIN' then do;
   rc = optsetn('xwait',0);
   rc = optsetn('xsync',0);
end;

Example 2: Using the SYMGETN Function

Return the value of the macro variable UNIT at program execution time:

nval=symgetn('unit');

Example 3: Returning Macro Values at Program Compile Time

Return the values of the macro variables UNIT and SYSJOBID at program compile time:

nval=&unit;
cval="&sysjobid";

See Also

SYMPUT and SYMPUTN


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.