<?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: Permanent Macro Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517425#M139889</link>
    <description>&lt;P&gt;Put the data in a dataset.&amp;nbsp; Simply put macro is not a system for storing or processing data.&amp;nbsp; It is a find/replace system for generating text, and only that.&lt;/P&gt;
&lt;P&gt;Base SAS which insludes the full programming language, types, datasets and such like, is for storing and processing data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the right tool for the right job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is a parameter, which needs to be available at system startup, then you create that parameter in the autoexec.sas file.&amp;nbsp; But that is not the system to use for storage of data.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Nov 2018 12:01:35 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-11-30T12:01:35Z</dc:date>
    <item>
      <title>Permanent Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517423#M139888</link>
      <description>&lt;P&gt;Hello Guys,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone tell me is there any way to store the macro variable permanently so that it will exist across all upcoming SAS session too, I read about STORE option and AUTOCALL library but those things for macro code, is that applicable for storing macro variable??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any way to storing and updating macro variable across the session?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517423#M139888</guid>
      <dc:creator>arunrami</dc:creator>
      <dc:date>2018-11-30T12:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517425#M139889</link>
      <description>&lt;P&gt;Put the data in a dataset.&amp;nbsp; Simply put macro is not a system for storing or processing data.&amp;nbsp; It is a find/replace system for generating text, and only that.&lt;/P&gt;
&lt;P&gt;Base SAS which insludes the full programming language, types, datasets and such like, is for storing and processing data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the right tool for the right job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is a parameter, which needs to be available at system startup, then you create that parameter in the autoexec.sas file.&amp;nbsp; But that is not the system to use for storage of data.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517425#M139889</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-11-30T12:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517433#M139891</link>
      <description>&lt;P&gt;What do you want to control with that macro variable?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517433#M139891</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-30T12:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517449#M139901</link>
      <description>Since we cant refer the variable from different dataset, I would like to store that in to macro variable and call it when ever needed.&lt;BR /&gt;&lt;BR /&gt;Just an example:-&lt;BR /&gt;/*First session*/&lt;BR /&gt;Data X;&lt;BR /&gt;Set libr.Old;&lt;BR /&gt;call symput('prevtime',start_time);/*This should be stored till next session*/&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Next session:&lt;BR /&gt;Data A;&lt;BR /&gt;set New;&lt;BR /&gt;if start_time&amp;lt;&amp;gt;&amp;amp;prevtime;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Nov 2018 13:00:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517449#M139901</guid>
      <dc:creator>arunrami</dc:creator>
      <dc:date>2018-11-30T13:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517456#M139904</link>
      <description>&lt;P&gt;The only way to directly get a macro variable into a session is to set it in one of the autoexec resources, and you DO NOT DO THAT dynamically.&lt;/P&gt;
&lt;P&gt;Instead, write it to a dataset every time you leave a session:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sasuser.macrovars;
length
  name $32
  value $64
;
input name;
value = symget(name);
cards;
prevtime
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you can now add static(!) code to your autoexec:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sasuser.macrovars;
call symput(name,value);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Instead of sasuser, use any permanent library you have.&lt;/P&gt;
&lt;P&gt;You can add the first code in your EG as code to be submitted after each task and SAS Code, and the second as code being sent when a server connection is established.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 13:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517456#M139904</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-30T13:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517463#M139909</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;Since we cant refer the variable from different dataset" - why can't you?&amp;nbsp; There is merging/joining, formats, lookups etc.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table a as
  select *
  from   new
  where start_time &amp;lt;&amp;gt; (select start_time from libr.old);
quit;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Replaces the two steps you show.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 13:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Macro-Variable/m-p/517463#M139909</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-11-30T13:49:19Z</dc:date>
    </item>
  </channel>
</rss>

