<?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: Call Symput in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81880#M17684</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, then can you tell me why I am not getting the expected result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;x=dav;&lt;/P&gt;&lt;P&gt;if x = div then call symput('holdid', 'div' ); &lt;BR /&gt;else if x = dav then call symput('holdid', 'dav'); &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put holdid= &amp;amp;holdid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the following result:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable HOLDID resolves to div&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;807&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;808&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;809 %put holdid= &amp;amp;holdid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;holdid= div&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Nov 2012 16:22:00 GMT</pubDate>
    <dc:creator>Sarojkumar</dc:creator>
    <dc:date>2012-11-27T16:22:00Z</dc:date>
    <item>
      <title>Call Symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81877#M17681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not able to get why the following code is not working properly. Can anybody pls help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let x = dav;&lt;BR /&gt;data xx;&lt;/P&gt;&lt;P&gt;if &amp;amp;x = div then call symput('holdid', 'div' ); &lt;BR /&gt;else if &amp;amp;x = dav then call symput('holdid', 'dav'); &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%put x= &amp;amp;x;&lt;BR /&gt;%put holdid= &amp;amp;holdid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why the result is coming as follows and what might be alternative solution?&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable X resolves to dav&lt;/P&gt;&lt;P&gt;713&lt;/P&gt;&lt;P&gt;714&lt;/P&gt;&lt;P&gt;715&amp;nbsp; %put x= &amp;amp;x;&lt;/P&gt;&lt;P&gt;x= dav&lt;/P&gt;&lt;P&gt;716&amp;nbsp; %put holdid= &amp;amp;holdid;&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable HOLDID resolves to div&lt;/P&gt;&lt;P&gt;holdid= div&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81877#M17681</guid>
      <dc:creator>Sarojkumar</dc:creator>
      <dc:date>2012-11-27T16:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Call Symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81878#M17682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are you trying to do?&lt;/P&gt;&lt;P&gt;This piece of code doesn't do anything...?&lt;/P&gt;&lt;P&gt;If you are trying to&amp;nbsp; assign the macro variable holid depending on the value of X, the you should use pure macro logic, no use for a data step if this is the case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81878#M17682</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2012-11-27T16:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Call Symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81879#M17683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Certainly LinusH is correct in that you could always use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let holdid = &amp;amp;x;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably your question is a simplification of a more complicated scenario.&amp;nbsp; The reason you are getting your results goes back to this DATA step statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if dav = div then call symput (.....);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's the code that SAS sees, after macro language finishes resolving &amp;amp;X.&amp;nbsp; In a DATA step, DAV and DIV will both be numeric variables with a missing value, so the comparison will be true.&amp;nbsp; One way to get around it, if&amp;nbsp; you really need to do that for a more complex scenario, is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if "&amp;amp;x" = "div" then call symput (.....);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That way, after resolving &amp;amp;X, SAS compares:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if "dav" = "div" then call symput (.....);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81879#M17683</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-11-27T16:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Call Symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81880#M17684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, then can you tell me why I am not getting the expected result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;x=dav;&lt;/P&gt;&lt;P&gt;if x = div then call symput('holdid', 'div' ); &lt;BR /&gt;else if x = dav then call symput('holdid', 'dav'); &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put holdid= &amp;amp;holdid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the following result:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable HOLDID resolves to div&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;807&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;808&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;809 %put holdid= &amp;amp;holdid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;holdid= div&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81880#M17684</guid>
      <dc:creator>Sarojkumar</dc:creator>
      <dc:date>2012-11-27T16:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Call Symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81881#M17685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But you are getting the expected result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X is a numeric variable, with a missing value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DAV is a numeric variable, with a missing value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIV is a numeric variable with a missing value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this comparison is true:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x = div then call symput ....;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore, the ELSE statement is ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81881#M17685</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-11-27T16:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Call Symput</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81882#M17686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Astounding. I mixed up the datastep processing concepts with macro processing concepts. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-Symput/m-p/81882#M17686</guid>
      <dc:creator>Sarojkumar</dc:creator>
      <dc:date>2012-11-27T16:57:46Z</dc:date>
    </item>
  </channel>
</rss>

