<?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: Why do we use call symput('something', apersonname)? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741344#M231732</link>
    <description>I think this is the most important difference:&lt;BR /&gt;Call Symput and Call Symputx allow creating macro variables from values in&lt;BR /&gt;a data set. So if the data changes the value of the macro variable can&lt;BR /&gt;change. "Dynamic code" sometimes is used with this.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue&lt;BR /&gt;</description>
    <pubDate>Fri, 14 May 2021 04:35:27 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2021-05-14T04:35:27Z</dc:date>
    <item>
      <title>Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741016#M231593</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;Why do we use&amp;nbsp;call symput('something', apersonname) inside a sas statement? Can't we use %let&lt;/P&gt;
&lt;P&gt;something = apersonname?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Blue Blue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 05:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741016#M231593</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-13T05:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741022#M231599</link>
      <description>&lt;P&gt;Maxim 4. Try it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let something = apersonname;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;works before any data step code runs, and will assign the&amp;nbsp;&lt;EM&gt;text&lt;/EM&gt; apersonname to the macro variable. CALL SYMPUT, OTOH, is a data step function and will assign the&amp;nbsp;&lt;EM&gt;current content&lt;/EM&gt; of data step variable apersonname to the macro variable.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 05:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741022#M231599</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-13T05:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741024#M231600</link>
      <description>&lt;P&gt;Use of %let pretty much means that you, as in the person writing code, know the value you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Call Symput and Call Symputx allow creating macro variables from values in a data set. So if the data changes the value of the macro variable can change. "Dynamic code" sometimes is used with this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the both of the function do similar things but one is less likely to have issues with spaces (documentation to find which one). Also since the functions are executable you can test other variables and conditionally create the macro variable.&lt;/P&gt;
&lt;P&gt;Caution: the assigned value when using a data set will come from the &lt;STRONG&gt;last&lt;/STRONG&gt; time the Symput/Symputx executes. So if you aren't familiar with your data you might expect one result but get another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another reason to use the Symput function. The name of the macro variable could be the value of a character variable. So you might have a data set that contains a bunch of names and values to create a bunch of macro variables.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 05:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741024#M231600</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-13T05:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741343#M231731</link>
      <description>Why the code:&lt;BR /&gt;Data _NULL_;&lt;BR /&gt;Set SAShelp._CMPIDX_;&lt;BR /&gt;Call symput('ABC',key);&lt;BR /&gt;Run;&lt;BR /&gt;%put  &amp;amp;ABC;&lt;BR /&gt;doesn't return all the values in variable key? It only returns the last observation in the key variable?&lt;BR /&gt;&lt;BR /&gt;I don't understand this part:&lt;BR /&gt;"So you might have a data set that contains a bunch of names and values to create a bunch of macro variables."&lt;BR /&gt;&lt;BR /&gt;I hope this makes sense.&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue</description>
      <pubDate>Fri, 14 May 2021 04:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741343#M231731</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-14T04:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741344#M231732</link>
      <description>I think this is the most important difference:&lt;BR /&gt;Call Symput and Call Symputx allow creating macro variables from values in&lt;BR /&gt;a data set. So if the data changes the value of the macro variable can&lt;BR /&gt;change. "Dynamic code" sometimes is used with this.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue&lt;BR /&gt;</description>
      <pubDate>Fri, 14 May 2021 04:35:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741344#M231732</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-14T04:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741349#M231737</link>
      <description>&lt;P&gt;As I said previously, the CALL SYMPUT(X) routine stores the&amp;nbsp;&lt;EM&gt;current content&lt;/EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;of its second argument into the macro variable. So the macro variable will contain what was in the second argument of the routine when it was last called.&lt;/P&gt;
&lt;P&gt;For your second question, suppose you have a dataset&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input name $ value $;
datalines;
a 1
b x
c f3
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you run&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set have;
call symputx(name,value);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you will create three macro variables with the contents of value.&lt;/P&gt;
&lt;P&gt;This is a way to preserve macro variable values between SAS sessions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Edit: fixed typo ("if" --&amp;gt; "of")&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 13:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741349#M231737</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-14T13:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741355#M231743</link>
      <description>Hello KurtBremser,&lt;BR /&gt;This is the log, the macro variable name should show 3 values on the log: 1 x  f3.&lt;BR /&gt;You can see the log doesn't show it.&lt;BR /&gt;&lt;BR /&gt;&amp;lt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 72         &lt;BR /&gt; 73         data _null_;&lt;BR /&gt; 74         set have;&lt;BR /&gt; 75         call symputx(name,value);&lt;BR /&gt; 76         run;&lt;BR /&gt;&amp;gt;&lt;BR /&gt;Per what you said:&lt;BR /&gt;"you will create three macro variables with the contents if value"&lt;BR /&gt;I can't understand if value?&lt;BR /&gt;perhaps, there should be something to print the value of a macro on the log.&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue&lt;BR /&gt;</description>
      <pubDate>Fri, 14 May 2021 05:42:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741355#M231743</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-14T05:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741364#M231750</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hello KurtBremser,&lt;BR /&gt;This is the log, the macro variable name should show 3 values on the log: 1 x f3.&lt;BR /&gt;You can see the log doesn't show it.&lt;BR /&gt;&lt;BR /&gt;&amp;lt; 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt;72 &lt;BR /&gt;73 data _null_;&lt;BR /&gt;74 set have;&lt;BR /&gt;75 call symputx(name,value);&lt;BR /&gt;76 run;&lt;BR /&gt;&amp;gt;&lt;BR /&gt;Per what you said:&lt;BR /&gt;"you will create three macro variables with the contents if value"&lt;BR /&gt;I can't understand if value?&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;perhaps, there should be something to print the value of a macro on the log.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;%put _user_;&lt;/P&gt;
&lt;P&gt;will place a list of all of the user (that's you) defined macro variables and the values into the Log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would be AFTER the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you could use something like:&lt;/P&gt;
&lt;PRE&gt;data _null_;
   set have;
   call symputx(name,value);
  put "created macro variable " name= " should have value " value=;
run;&lt;/PRE&gt;
&lt;P&gt;to display them when created.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 08:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741364#M231750</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-14T08:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741446#M231774</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;Per what you said:&lt;BR /&gt;"you will create three macro variables with the contents if value"&lt;BR /&gt;I can't understand if value?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That was a typo, fixed in the meanwhile.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 13:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741446#M231774</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-14T13:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why do we use call symput('something', apersonname)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741581#M231825</link>
      <description>&lt;P&gt;Yes, you have got it!&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 22:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-do-we-use-call-symput-something-apersonname/m-p/741581#M231825</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-05-14T22:19:12Z</dc:date>
    </item>
  </channel>
</rss>

