<?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: Symget to get values of the variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598272#M172527</link>
    <description>Macro variable don't have quotes in it. So can I tackle it with only&lt;BR /&gt;%sysfunc function by removing deqoute function per your post?&lt;BR /&gt;</description>
    <pubDate>Mon, 21 Oct 2019 21:42:11 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2019-10-21T21:42:11Z</dc:date>
    <item>
      <title>Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598203#M172488</link>
      <description>&lt;UL&gt;
&lt;LI&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test(keep=x y);
Set have;
x=symget('field_list');
*macro variable field_list resolves to id!!age!!sex
y=id!!age!!sex;
run; &lt;/CODE&gt;&lt;/PRE&gt;
In the above code I except the variables x and y to produce the same value in the output but in the variable 'x' I'm getting values as 'id!!age!!sex' instead of the respective values of those variables. What I'm missing while I creating the variable 'x'?&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Variable y producing the values of variables&amp;nbsp; 'id!!age!!sex' which is available in have dataset in the output. E.g.'00125M'&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 21 Oct 2019 18:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598203#M172488</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-21T18:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598206#M172491</link>
      <description>&lt;P&gt;You are vastly overcomplicating the problem.&amp;nbsp; SYMGET is not needed to retrieve the value of a macro variable.&amp;nbsp; Simply use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x = &amp;amp;field_list;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Oct 2019 18:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598206#M172491</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-21T18:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598207#M172492</link>
      <description>I tried this method already and it is producing the same result as it&lt;BR /&gt;produce with symget function.&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Oct 2019 18:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598207#M172492</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-21T18:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598208#M172493</link>
      <description>&lt;P&gt;Then you will need to show the log, as well as the results from this statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put *&amp;amp;field_list*;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 18:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598208#M172493</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-21T18:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598210#M172494</link>
      <description>I don't have SAS at the moment to send you the log.But I remember that the&lt;BR /&gt;macro variable resolved to 'id!!age!!sex'&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Oct 2019 18:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598210#M172494</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-21T18:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598216#M172496</link>
      <description>&lt;P&gt;If the macro variable has the quotes in it then you need to remove them.&lt;/P&gt;
&lt;P&gt;So if you have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let macrovar='id!!age!!sex';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you use this statement in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x = %sysfunc(dequote(&amp;amp;macrovar));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then it is the same as using this statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x = id!!age!!sex ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Oct 2019 19:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598216#M172496</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-21T19:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598218#M172497</link>
      <description>&lt;P&gt;X will get the macro variable as on long string 'id!!age!!sex';&lt;/P&gt;
&lt;P&gt;Y will concatenate the values of the 3 variables mentioned: &lt;STRONG&gt;ID, age, sex.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;AS long those 3 variables exist in HAVE table you'll get different result, otherwise a warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get the same result you should assign y='id!!age!!sex';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 19:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598218#M172497</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-10-21T19:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598272#M172527</link>
      <description>Macro variable don't have quotes in it. So can I tackle it with only&lt;BR /&gt;%sysfunc function by removing deqoute function per your post?&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Oct 2019 21:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598272#M172527</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-21T21:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598273#M172528</link>
      <description>If the macro variable does not have quotes then just expand the macro variable to generate the code.&lt;BR /&gt;x = &amp;amp;macrovar ;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Oct 2019 21:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598273#M172528</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-21T21:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Symget to get values of the variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598274#M172529</link>
      <description>&lt;P&gt;They should NOT produce the same value.&lt;/P&gt;
&lt;P&gt;The first is getting the value of the macro variable as a character string.&lt;/P&gt;
&lt;P&gt;The second is concatenating the values of three dataset variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want them to produce the same values then perhaps you don't want to use SYMGET() at all. Just expand the macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x=&amp;amp;field_list;
y=id!!age!!sex;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So to the data step that will be the same as if you typed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x=id!!age!!sex;
y=id!!age!!sex;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Oct 2019 22:02:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symget-to-get-values-of-the-variables/m-p/598274#M172529</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-21T22:02:38Z</dc:date>
    </item>
  </channel>
</rss>

