The output below was created using %put _global_ ; while the table below was generated via the %putmacros() call.
GLOBAL SQLOBS 11
GLOBAL SQLOOPS 55
GLOBAL SYS_SQL_IP_ALL -1
GLOBAL SYS_SQL_IP_STMT
GLOBAL SQLXOBS 0
GLOBAL SQLRC 0
GLOBAL SEX1 F
GLOBAL SQLEXITCODE 0
GLOBAL SEX2 M
GLOBAL AVGWEIGHT1 90.11
GLOBAL AVGWEIGHT2 108.95
<pre>
proc sql noprint ;
select sex
, avg( weight )
into :sex1 - :sex99
, :avgweight1 - :avgweight99
from sashelp.class
group by sex ;
quit ;
%putmacros()
/****************************************************************
* Program: putmacros.sas
* Author: Tom Bellmer
* Created: 26Jan2011
* Purpose: writes a sorted list of macro variables
* Usage: %putmacros( scope= ) ;
* Notes: Scope value can be ALL, AUTOMATIC, GLOBAL or LOCAL
* Modified:
****************************************************************/
%macro putmacros( scope = GLOBAL ) ;
%local whereclause ;
%let scope = %upcase( &scope ) ;
%if &scope = ALL %then %let whereclause = 1 = 1;
%else %if &scope = LOCAL %then %let whereclause = scope not in ( 'AUTOMATIC', 'GLOBAL' ) ;
%else %let whereclause = scope = "&scope" ;
proc sql ;
create table putmacrosdataset as
select name
, value
, scope length = 32
, offset
from dictionary.macros
where &whereclause
order by name
, offset ;
quit ;
dm "viewtable putmacrosdataset view=table (label='Macro Variables')" viewtable ;
%mend ;
/* EOF: putmacros.sas */
</pre>
No comments:
Post a Comment