<?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 How to use macro variable that created using CALL SYMPUT in another macro step in Advanced Programming</title>
    <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715581#M54</link>
    <description>&lt;P&gt;I have created a macro variable using CALL SYMPUT in data step... I need to use that macro variable in another macro program in IF-ELSE condition with out using SYMGET... How to get the result?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;my call symput program is&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Data syed;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;if age &amp;gt;=13 then CALL SYMPUT('status','adult');&lt;BR /&gt;else CALL SYMPUT('stat','minor);&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I got the value for this macro variable using SYMGET function in data step.. -- This method is working fine&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;DATA ibbu;&lt;BR /&gt;SET sashelp.class;&lt;BR /&gt;if Age&amp;gt;=13 then status=SYMGET('status');&lt;BR /&gt;else status =SYMGET('stat');&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need to achieve the same result in macro program in if else statement without using SYMGET... how to achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i tried this way... it didn't work for me...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;%macro ibrahim;&lt;BR /&gt;data ibbu;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;%If Age&amp;gt;=13 %then %do; status= "&amp;amp;status" ; %end;&lt;BR /&gt;%else %if Age&amp;lt;13 %then %do; status= "&amp;amp;stat"; %end;&lt;BR /&gt;%mend ibrahim;&lt;BR /&gt;%ibrahim;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per Condition it is not working.. It set all value of status to "adult". Can someone guide me on this one?&lt;/P&gt;</description>
    <pubDate>Sat, 30 Jan 2021 20:50:35 GMT</pubDate>
    <dc:creator>_el_doredo</dc:creator>
    <dc:date>2021-01-30T20:50:35Z</dc:date>
    <item>
      <title>How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715581#M54</link>
      <description>&lt;P&gt;I have created a macro variable using CALL SYMPUT in data step... I need to use that macro variable in another macro program in IF-ELSE condition with out using SYMGET... How to get the result?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;my call symput program is&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Data syed;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;if age &amp;gt;=13 then CALL SYMPUT('status','adult');&lt;BR /&gt;else CALL SYMPUT('stat','minor);&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I got the value for this macro variable using SYMGET function in data step.. -- This method is working fine&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;DATA ibbu;&lt;BR /&gt;SET sashelp.class;&lt;BR /&gt;if Age&amp;gt;=13 then status=SYMGET('status');&lt;BR /&gt;else status =SYMGET('stat');&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need to achieve the same result in macro program in if else statement without using SYMGET... how to achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i tried this way... it didn't work for me...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;%macro ibrahim;&lt;BR /&gt;data ibbu;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;%If Age&amp;gt;=13 %then %do; status= "&amp;amp;status" ; %end;&lt;BR /&gt;%else %if Age&amp;lt;13 %then %do; status= "&amp;amp;stat"; %end;&lt;BR /&gt;%mend ibrahim;&lt;BR /&gt;%ibrahim;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per Condition it is not working.. It set all value of status to "adult". Can someone guide me on this one?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2021 20:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715581#M54</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-01-30T20:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715868#M55</link>
      <description>&lt;P&gt;I can't see what you are hoping to accomplish with your macro code. Remember,&amp;nbsp;MACRO programs are used to &lt;EM&gt;write&lt;/EM&gt; DATA steps. It's the DATA step program that processes the data. Before the DATA step can run, the MACRO must have already finished writing it. So I'm not seeing what it is your macro code is trying to accomplish. Can you describe the result you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 19:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715868#M55</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-02-01T19:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715869#M56</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Unfortunately, the way you are using macros will not work. Can you please be specific in what you are trying to accomplish? This will help in guiding you as the code you provide is confusing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just curious, have you thought of taking the SAS Macro Training?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 19:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715869#M56</guid>
      <dc:creator>CarmineVerrell</dc:creator>
      <dc:date>2021-02-01T19:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715873#M57</link>
      <description>Sorry for the confusion here... I got my answer.. It's the percentage sign causing the issue for me... If i remove percentage sign in data step means it worked for me... Thanks for your response</description>
      <pubDate>Mon, 01 Feb 2021 19:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715873#M57</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-02-01T19:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715874#M58</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/366820"&gt;@_el_doredo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sorry for the confusion here... I got my answer.. It's the percentage sign causing the issue for me... If i remove percentage sign in data step means it worked for me... Thanks for your response&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you mean that you reverted you program just use normal IF/THEN statements instead of trying to use %IF/%THEN macro statements?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 19:21:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715874#M58</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-01T19:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715877#M59</link>
      <description>Yeah exactly like this. I am in learning phase... but,this method worked for me&lt;BR /&gt;&lt;BR /&gt;%macro ibrahim;&lt;BR /&gt;data ibbu;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;If Age&amp;gt;=13 then do; status= "&amp;amp;status" ; end;&lt;BR /&gt;else do; status= "&amp;amp;stat"; end;&lt;BR /&gt;%mend ibrahim;&lt;BR /&gt;%ibrahim;</description>
      <pubDate>Mon, 01 Feb 2021 19:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/715877#M59</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-02-01T19:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/716039#M60</link>
      <description>&lt;P&gt;I would highly recommend taking the&amp;nbsp;SAS Macro Language 1: Essentials course as it will explain all the concepts that are confusing you and show you how to create a data-driven program. Great course and very useful.&lt;/P&gt;
&lt;P&gt;Carmine&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 12:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/716039#M60</guid>
      <dc:creator>CarmineVerrell</dc:creator>
      <dc:date>2021-02-02T12:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/716044#M61</link>
      <description>Yeah sure.. It will be helpful for me to learn more about SAS macros.. Thanks for your suggestion</description>
      <pubDate>Tue, 02 Feb 2021 12:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/716044#M61</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-02-02T12:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro variable that created using CALL SYMPUT in another macro step</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/717049#M62</link>
      <description>&lt;P&gt;Hi , this reminds me my first time to use Macro, I didn't understand the difference between %if -%then&amp;nbsp; and if- then&lt;/P&gt;
&lt;P&gt;kindly find my findings:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;'%if-%then' can ONLY be used in the MACRO program (whether inside the DATA step, or outside) and 'if-then' is ONLY used inside the DATA step (whether MACRO or non-MACRO).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2.In the DATA step, you can use 'if alone to do logical comparison. But you can not use '%if alone. You also can not use '%else' alone without '%do; %end' pair.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3.'%if-%then' uses MACRO variables in logical expressions and can not refer to DATA step variables in logical expressions (you can not write: %if x=l %then %do; because x is not a MACRO variable), while 'if-then' can use MACRO variables or use DATA step variables in logical expressions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4.'%if-%then' in MACRO determines what text should be copied to the input stack. When you use 'if-then' inside a MACRO (or non-MACRO), it does logical comparison to determine what DATA step statements should be executed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, thanks@&lt;A class="trigger-hovercard" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/366820" target="_blank"&gt;_el_doredo&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 12:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-to-use-macro-variable-that-created-using-CALL-SYMPUT-in/m-p/717049#M62</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2021-02-05T12:02:28Z</dc:date>
    </item>
  </channel>
</rss>

