<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Macro variable count in Work Libraray in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753174#M237349</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I defined three macro variables so how yo count only user defined macros variable in work library&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The answer is ZERO. Macro variables are not in the WORK library. (Which was already explained by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; who said "The WORK library contains SAS datasets, catalogs etc. Macro variables just live in memory.")&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jul 2021 14:51:42 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-07-09T14:51:42Z</dc:date>
    <item>
      <title>Macro variable count in Work Libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753149#M237337</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let a=1;
%let b=New York;
%let c=12.5;

proc sql;
select scope,count(scope) label ='MACRO VARIABLE COUNT'
from dictionary.vmacro;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here I want to count defined macro variables count&amp;nbsp; in work libraray&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 13:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753149#M237337</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2021-07-09T13:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable count in Work Libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753154#M237338</link>
      <description>&lt;P&gt;The WORK library contains SAS datasets, catalogs etc.&amp;nbsp; Macro variables just live in memory.&amp;nbsp; You can see them using the DICTIONARY.MACROS table or SASHELP.VMACRO view to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to count the number of macro variables then count the distinct names per scope.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
 create table n_mvars as
  select scope,count(distinct name) as mvars
  from dictionary.macros
  group by scope
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    scope         mvars

 1     AUTOMATIC       72
 2     GLOBAL          71

&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jul 2021 14:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753154#M237338</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-09T14:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable count in Work Libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753156#M237339</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp; I am not quite sure what's your question or the problem. I do understand you want to query dictionary tables that contain Macro related info. Since you are using Dictionary.XXXX tables, you should be directly querying the table MACRO instead of the VIEW aka VMACRO.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;from dictionary.macros;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dictionary.vmacro;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jul 2021 14:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753156#M237339</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-07-09T14:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable count in Work Libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753173#M237348</link>
      <description>I defined three macro variables so how yo count only user defined macros variable in work library</description>
      <pubDate>Fri, 09 Jul 2021 14:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753173#M237348</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2021-07-09T14:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable count in Work Libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753174#M237349</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I defined three macro variables so how yo count only user defined macros variable in work library&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The answer is ZERO. Macro variables are not in the WORK library. (Which was already explained by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; who said "The WORK library contains SAS datasets, catalogs etc. Macro variables just live in memory.")&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 14:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753174#M237349</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-09T14:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable count in Work Libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753324#M237409</link>
      <description>&lt;P&gt;Use %put _user_; to get these user defined macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tmp temp;
proc printto log=tmp new;run;

%let a=1;
%let b=New York;
%let c=12.5;
%let d=12.5;


proc print data=sashelp.class;run;
%put start;
%put _user_;
%put end;
proc printto;run;



data _null_;
infile tmp  end=last;
input;
retain start;
if _infile_=: 'start' then start=1;
if start then n_macro_var+1;
if _infile_=: 'end' then do;
n_macro_var=n_macro_var-4;
putlog 'number of user defined macro variable is'  n_macro_var best8.;
stop;
end;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Jul 2021 10:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-count-in-Work-Libraray/m-p/753324#M237409</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-10T10:34:17Z</dc:date>
    </item>
  </channel>
</rss>

