Date: Tue, 10 Jan 2006 11:15:11 -0500
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Finding macro variables by means of metadata
Content-Type: text/plain; charset=ISO-8859-1
Toby,
sure, you are right: it would be nonsense to store "LOCAL" in scope, without
the information in which macro!
Whats also important: there is no "history" in the dictionary. So you cannot
see a kind of "trace" of the local variables through the macro calls. All
the local variables are disappeared after the macro has ended. If that is
needed the temporary content of vmacro must be stored in each macro to a
dataset or a global macro-variable, or ...
On Tue, 10 Jan 2006 15:46:44 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:
>Gerhard and Rune,
>
>One has to be careful where and when you look for local macro vars. Also in
>the Sashelp.vmacro and dictionary.macros tables the scope of the local
>variable will always be the name of the macro to which it is local to.
>
>
>/** Create Global Macro Var**/
>
>%let GMacVar = Global ;
>
>
>/** Create Local Macro Var**/
>
>%macro test ;
>%local LMacVar ;
>
>%let LMacVar = Local ;
>
>%mend ;
>
>
>%test
>
>/** First Try **/
>/**Look For Vars in Symbol Table **/
>proc print
> data = sashelp.vmacro ;
> where upcase(scope) not in ('AUTOMATIC') ;
>run ;
>
>
>
>/** Second Try **/
>/** Now Get Both local and global Mvars From Symbol Table**/
>
>%macro GetMvars ;
>
>%test
>
>
>proc print
> data = sashelp.vmacro ;
> where upcase(scope) not in ('AUTOMATIC') ;
>run ;
>
>%mend ;
>
>%GetMvars
>
>
>/** Second Try **/
>/** Now Get Both local and global Mvars From Symbol Table**/
>
>%macro ListMvars ;
>
>
>proc print
> data = sashelp.vmacro ;
> where upcase(scope) Not in ('AUTOMATIC') ;
>run ;
>
>%mend ;
>
>
>/** Re-Create Local Macro Var to get macro vars**/
>
>%macro test ;
>%local LMacVar ;
>
>%let LMacVar = Local ;
>
>%ListMvars
>%mend ;
>
>
>%test
>
>
>
>Toby Dunn
>
>
>
>
>
>From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
>Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Finding macro variables by means of metadata
>Date: Tue, 10 Jan 2006 10:31:39 -0500
>MIME-Version: 1.0
>Received: from malibu.cc.uga.edu ([128.192.1.103]) by
>bay0-mc11-f8.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 10
>Jan 2006 07:32:40 -0800
>Received: from listserv.cc.uga.edu (listserv.uga.edu [128.192.1.75])by
>malibu.cc.uga.edu (8.12.11/8.12.11) with ESMTP id k0ABkDTE018065;Tue, 10 Jan
>2006 10:31:39 -0500
>Received: from LISTSERV.UGA.EDU by LISTSERV.UGA.EDU (LISTSERV-TCP/IP release
> 1.8d) with spool id 558643 for SAS-L@LISTSERV.UGA.EDU; Tue, 10 Jan
> 2006 10:31:39 -0500
>Received: from mailgw.cc.uga.edu (mailgw.cc.uga.edu [128.192.1.101]) by
> listserv.cc.uga.edu (8.12.11/8.12.11) with ESMTP id k0AFVd2H010057
> for <SAS-L@LISTSERV.UGA.EDU>; Tue, 10 Jan 2006 10:31:39 -0500
>Received: from listserv.cc.uga.edu (listserv.uga.edu [128.192.1.75]) by
> mailgw.cc.uga.edu (8.12.11/8.12.11) with ESMTP id k0AExk5S009578 for
> <SAS-L@LISTSERV.UGA.EDU>; Tue, 10 Jan 2006 10:31:39 -0500
>X-Message-Info: VsBffbwlQ9b09syZCrbhNrO0eEqCR12GlBZS3iYAy+0=
>X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.cc.uga.edu
>id k0AFVd2H010064
>Return-Path: owner-sas-l@LISTSERV.UGA.EDU
>X-OriginalArrivalTime: 10 Jan 2006 15:32:40.0985 (UTC)
>FILETIME=[17F9A890:01C615FB]
>
>yes, the name is sashelp.vmacro
>
>There is a column named scope, which contains GLOBAL, LOCAL and AUTOMATIC
>You can also find out the names and the current content of each variable.
>
>
>
>
>On Tue, 10 Jan 2006 16:22:33 +0100, Rune Runnestø <rune@FASTLANE.NO> wrote:
>
> >All macro variables have to live in a table. Some of them live in the
>global
> >symbol table, others in the local symbol table. As far as I know there are
> >no other tables they can reside.
> >
> >Can we query the dictionary.macros to find out which ones resides where ?
> >Any suggestions how ?
> >
> >Rune
|