<?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: When to use symput or symget? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29765#M5650</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as I know, you have to use "call symput" or "call symputx". I have never used "symput" without "call".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2012 18:24:55 GMT</pubDate>
    <dc:creator>Linlin</dc:creator>
    <dc:date>2012-03-13T18:24:55Z</dc:date>
    <item>
      <title>When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29759#M5644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When to use symput or symget? &lt;/P&gt;&lt;P&gt;I just don't know what is the best way to use those functions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 15:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29759#M5644</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-13T15:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29760#M5645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;symput: creating macro variables in a datastep.&lt;/P&gt;&lt;P&gt;symget: getting macro variable value in a datastep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 16:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29760#M5645</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-13T16:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29761#M5646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You use CALL SYMPUT (or better CALL SYMPUTX as it is more flexible) to create macro variables from data step values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You use SYMGET to get macro variable values. Usually you can just reference the macro variable instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some situations where you would want to use SYMGET.&lt;/P&gt;&lt;P&gt;The values of the macro variable have been modified while the data step is running. For example by using CALL SYMPUTX.&lt;/P&gt;&lt;P&gt;To handle complex values that are hard to mask with macro quoting.&lt;/P&gt;&lt;P&gt;To hide the value from the SAS log (for example a password) without having to worry about SYMBOLGEN and MPRINT settings.&lt;/P&gt;&lt;P&gt;To delay when the macro value is evaluated, for example in the definition of a view.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 16:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29761#M5646</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-13T16:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29762#M5647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; name $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;8.&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;Art&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;Cynthia&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;Ksharp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;Tom&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;Hai-Kuo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 12pt;"&gt;/* to create macro variables teacher1-teacher5 */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; symputx(cats(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 12pt;"&gt;'teacher'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;,strip(_n_)),name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &amp;amp;teacher1 &amp;amp;teacher2 &amp;amp;teacher3 &amp;amp;teacher4 &amp;amp;teacher5;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 12pt;"&gt;/* to get the value of &amp;amp;teacher1 &amp;amp;teacher2 &amp;amp;teacher3 &amp;amp;teacher4 &amp;amp;teacher5 */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;5&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; expert=symget(cats(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 12pt;"&gt;'teacher'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;,i));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;=want;&lt;/SPAN&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 8pt;"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; i&amp;nbsp;&amp;nbsp;&amp;nbsp; expert&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 8pt;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; Art&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 8pt;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; Cynthia&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 8pt;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; Ksharp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 8pt;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp; Tom&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'SAS Monospace'; font-size: 8pt;"&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp; Hai-Kuo&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 17:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29762#M5647</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-13T17:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29763#M5648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Can you please illustrate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The values of the macro variable have been modified while the data step is running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. To handle complex values that are hard to mask with macro quoting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. To delay when the macro value is evaluated, for example in the definition of a view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apologize for my not understanding those points well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 17:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29763#M5648</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-13T17:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29764#M5649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;awesome example, quick question, instead of call routine,&lt;/P&gt;&lt;P&gt;can you use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;x =&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; symputx(cats(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 12pt;"&gt;'teacher'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;,strip(_n_)),name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;This is another confusing point, when to use call routine, not using function directly.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 18:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29764#M5649</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-13T18:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29765#M5650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as I know, you have to use "call symput" or "call symputx". I have never used "symput" without "call".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 18:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29765#M5650</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-13T18:24:55Z</dc:date>
    </item>
    <item>
      <title>When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29766#M5651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;symput and symputx are only available as call routines and not as functions.&amp;nbsp; Call routines and functions are not interchangable ideas.&amp;nbsp; Call routines are similar to functions and perform similar operations however, they are not used in assignment statements (your example x = sysputx...).&amp;nbsp; Call routines can return values to multiple variables simulateously(call scan vrs. scan) or none (call symputx).&amp;nbsp; Typically call routines exist instead of a function to obtain more than one value from a single statement.&amp;nbsp; The only really expections I can think of are the call routines that deal with macros such as call exeute, symdel, symput, symputn and symputx.&amp;nbsp; You could argue that a functional version of the call rountines should exist and provide a return value, somewhat similar to how dot notation objects do but this is not available at this time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29766#M5651</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-03-13T19:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29767#M5652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #eef4f9;"&gt;1. The values of the macro variable have been modified while the data step is running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a simple example.&amp;nbsp; Obviously the data step would need to much more complex to make it worth worrying about this.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;%let mvar=before;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var1="&amp;amp;mvar";&lt;/P&gt;&lt;P&gt;&amp;nbsp; var2=symget('mvar');&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('mvar','after');&lt;/P&gt;&lt;P&gt;&amp;nbsp; var3=symget('mvar');&lt;/P&gt;&lt;P&gt;&amp;nbsp; put (var1-var3) (=);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;2. To handle complex values that are hard to mask with macro quoting.&lt;/P&gt;&lt;P&gt;Macro programs are hard enough to read. If you have to start worrying about %quote(), %bquote(), %nrstr() , %superq(), %unquote() etc it can becomes almost indecipherable.&lt;/P&gt;&lt;P&gt;If the purpose was to pass a value to data step then you can use SYMGET() function to pull the value and not need to worry whether the value includes &amp;amp;,%, or unbalanced quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;3. To delay when the macro value is evaluated, for example in the definition of a view.&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;Try this little example.&amp;nbsp; Do you see why the second time the data pulled by the two views do not match?&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;data studies;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do study='A001','B002','C003';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let study=A001;&lt;/P&gt;&lt;P&gt;data view1/view=view1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set studies;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if study="&amp;amp;study";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data view2/view=view2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set studies;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if study=symget('study');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc compare data=view1 compare=view2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let study=B002;&lt;/P&gt;&lt;P&gt;proc compare data=view1 compare=view2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 20:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29767#M5652</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-13T20:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29768#M5653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hello Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;really appreciate the illustrations. &lt;/P&gt;&lt;P&gt;But for the 3rd point, why there is a delay for symget varaiable to be evaluated?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2012 22:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29768#M5653</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-14T22:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29769#M5654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS stores the function into the view, but does not run it when it is building the view.&amp;nbsp; Instead the SYMGET() function runs when you use the view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use this to store the view as a permanent file in a SAS library.&amp;nbsp; Then the records returned by the view will be based on the current settings of the macro variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 21:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29769#M5654</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-15T21:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29770#M5655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; ZRick, I think it would be useful to future readers if you signaled one of Tom's answers as the correct one. Thanks for an interesting question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 21:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29770#M5655</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-03-15T21:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29771#M5656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PGStats,&amp;nbsp; ZRick (like a number of others who ask questions here) never bother to mark answers as being either helpful or correct.&amp;nbsp; Besides the fact that it would help users when they search for something, I think it would also encourage people to respond when those same individuals post new questions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 22:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29771#M5656</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-03-15T22:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: When to use symput or symget?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29772#M5657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the great lecture, Tom. Bookmarked!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2012 02:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-to-use-symput-or-symget/m-p/29772#M5657</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-16T02:16:12Z</dc:date>
    </item>
  </channel>
</rss>

