<?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: problem with using %goto in a data step in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100663#M28301</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not an appropriate use of Macro statements. You can accomplish everything you need in a data step, without ever using a macro. See the documentation for the LINK statement for examples on how to branch to specific code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Aug 2012 12:39:21 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2012-08-23T12:39:21Z</dc:date>
    <item>
      <title>problem with using %goto in a data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100661#M28299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;It seems in the SAS code below ,%goto statement doesn't work properly in a data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please advise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro testgoto(aaa);&lt;BR /&gt;data one;&lt;BR /&gt;x=symget('aaa');&lt;BR /&gt;put x=;&lt;BR /&gt;if x='ok' then do;&lt;/P&gt;&lt;P&gt;put ''x=ok;&lt;BR /&gt;%goto exit;&lt;BR /&gt;end;&lt;BR /&gt;else&lt;BR /&gt;do;&lt;/P&gt;&lt;P&gt;put 'x ^=ok';&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;%put Before exit;&lt;BR /&gt;%exit:&lt;BR /&gt;%put after exit;&lt;BR /&gt;%mend testgoto;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%testgoto(aaa=ok);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2012 19:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100661#M28299</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-08-21T19:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: problem with using %goto in a data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100662#M28300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%GOTO doesn't have anything to do with a data step.&amp;nbsp; It is part of SAS macro language. SAS macro language is just used to generate text strings that SAS can then try to interpret as a program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your macro has no macro logic in it.&amp;nbsp; So the generated code will always be:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data one;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;x=symget('aaa');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;put x=;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if x='ok' then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;put ''x=ok;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;That is not even a complete data step.&amp;nbsp; So if you call this macro you will need too at least add an END; statement to close the DO loop that the code generated by the macro started.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2012 19:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100662#M28300</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-08-21T19:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: problem with using %goto in a data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100663#M28301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not an appropriate use of Macro statements. You can accomplish everything you need in a data step, without ever using a macro. See the documentation for the LINK statement for examples on how to branch to specific code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 12:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100663#M28301</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2012-08-23T12:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: problem with using %goto in a data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100664#M28302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use goto in a data step but without the percentage at the begining.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just goto instead of %goto.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2012 14:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-using-goto-in-a-data-step/m-p/100664#M28302</guid>
      <dc:creator>Sidi</dc:creator>
      <dc:date>2012-08-23T14:33:57Z</dc:date>
    </item>
  </channel>
</rss>

