<?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: controlling flow in DATA step? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55003#M11706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; PG-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great tip on looking for leading and trailing blanks - as it turns out, there was not an issue in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really like the SELECT WHEN - OTHERWISE structure you suggested. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will play around with functions and your suggested structure to make this better now that I have a working solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wendy T&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2012 15:58:35 GMT</pubDate>
    <dc:creator>WendyT</dc:creator>
    <dc:date>2012-04-04T15:58:35Z</dc:date>
    <item>
      <title>controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/54998#M11701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS Folks-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have hit a sticky problem in trying to consolidate code that is running in several places to just one set of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scenario is that I'm picking groups of data out of our Oracle database, adding some other data, and then performing some specific operations, all of which depends on the initial group selection.&amp;nbsp; The groups are defined by macro variable PROJ_RUN, the dataset from Oracle is dataset &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS, and the additional data is SPECIALS.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have sucessfully set up SQL from Oracle to get &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS, and set up the SPECIAL data to add.&amp;nbsp; I'm having trouble with the last part, where I need to do some operations on the 'whole' dataset. (these are simple line deletions or calculations based on the value of a variable).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following data step, I would like to run only the bits inside the DO loop specified by the value of &amp;amp;PROJ_RUN, but everything in the data step runs whether the value of &amp;amp;PROJ_RUN is IRL or NCB.&amp;nbsp; When I get through, there will probably be 15 or so groups, so I'm looking for a low maintenance solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any advice you can give me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wendy T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS ; SET &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS SPECIALS ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IF COMPARE("&amp;amp;PROJ_RUN","IRL")=0 THEN &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS" ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\COLUMN_IF_DELETE_FIELD_J_CODES.SAS"&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\ADD_IRL_SEGMENTS.SAS";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IF COMPARE("&amp;amp;PROJ_RUN","NCB")=0 THEN &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS" ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\CALC_NCB_CODES.SAS"&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RUN ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 20:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/54998#M11701</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2012-04-03T20:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/54999#M11702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a guess. You might have leading or trailling blanks in your macro variable, try COMPARE(TRIM("&amp;amp;PROJ_RUN"),"IRL","L").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 01:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/54999#M11702</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-04-04T01:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55000#M11703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;COMPARE is not really needed in this situation. You do not seem to care at what position in the string the values diverge.&lt;/P&gt;&lt;P&gt;Just use the = operator.&amp;nbsp; "&amp;amp;proj_run"='IRL'&lt;/P&gt;&lt;P&gt;Also watch for case of your macro variable value.&amp;nbsp; Are you sure that it is uppercase?&amp;nbsp; You could try&lt;/P&gt;&lt;P&gt;IF "%upcase(&amp;amp;proj_run)"='IRl'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also what do you mean by running all of it.&amp;nbsp; You do realize that the %INC's will happen unconditionally.&amp;nbsp; If you want to make it conditional you need to wrap this code inside a macro so that you could convert your IF statement to %IF statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 01:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55000#M11703</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-04-04T01:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55001#M11704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are looking to lowering your long term maintenance effort, you might be better served with the structure :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;DATA &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS .; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;SET &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS. SPECIALS ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; SELECT (UPCASE(TRIM(LEFT("&amp;amp;PROJ_RUN."))));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN("IRL") DO ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY.\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS" ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY.\COLUMN_IF_DELETE_FIELD_J_CODES.SAS"&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY.\ADD_IRL_SEGMENTS.SAS";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN("NCB") DO ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY.\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS" ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY.\CALC_NCB_CODES.SAS"&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OTHERWISE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;RUN ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;PG&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 01:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55001#M11704</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-04-04T01:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55002#M11705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Macro was the key!&amp;nbsp; I absolutely did not know that the %INCLUDE bits needed to be wrapped - and that was my main issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following runs beautifully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wendy T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MACRO&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;STRONG&gt;&lt;EM&gt;ADDSPECIAL&lt;/EM&gt;&lt;/STRONG&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;DATA &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;DATA_LIB.&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;amp;DSN_FINALS ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp; SET &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;DATA_LIB.&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;amp;DSN_FINALS SPECIALS ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%IF&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"&amp;amp;PROJ_RUN"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"IRL"&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%THEN&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%DO&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%INCLUDE&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"&amp;amp;UTILITY\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%INCLUDE&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"&amp;amp;UTILITY\COLUMN_IF_DELETE_FIELD_J_CODES.SAS"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%INCLUDE &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"&amp;amp;UTILITY\ADD_IRL_SEGMENTS.SAS"&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%END&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%IF&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"&amp;amp;PROJ_RUN"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"NCB"&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%DO&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%INCLUDE&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"&amp;amp;UTILITY\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%INCLUDE&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"&amp;amp;UTILITY\CALC_NCB_CODES.SAS"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;%END&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;%MEND&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;%&lt;STRONG&gt;&lt;EM&gt;ADDSPECIAL&lt;/EM&gt;&lt;/STRONG&gt; ; &lt;/SPAN&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 15:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55002#M11705</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2012-04-04T15:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55003#M11706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; PG-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great tip on looking for leading and trailing blanks - as it turns out, there was not an issue in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really like the SELECT WHEN - OTHERWISE structure you suggested. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will play around with functions and your suggested structure to make this better now that I have a working solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wendy T&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 15:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55003#M11706</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2012-04-04T15:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55004#M11707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably still need to take more care about the order of macro code expansion and code generation.&lt;/P&gt;&lt;P&gt;You have the start of the data step inside the macro but not the end.&amp;nbsp; Why?&amp;nbsp; Did you intend for the user of the macro add more data step code after the macro call?&amp;nbsp; If so then perhaps you should just remove the DATA and SET statments also?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;%MACRO ADDSPECIAL(type) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %IF "&amp;amp;type"="IRL" %THEN %DO ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS" ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\COLUMN_IF_DELETE_FIELD_J_CODES.SAS"&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\ADD_IRL_SEGMENTS.SAS";&lt;/P&gt;&lt;P&gt; %END ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %IF "&amp;amp;type"="NCB" %THEN %DO ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\COLUMN_IF_DELETE_SECCHI_L_CODES.SAS" ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %INCLUDE "&amp;amp;UTILITY\CALC_NCB_CODES.SAS"&amp;nbsp; ;&lt;/P&gt;&lt;P&gt; %END ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MEND addspecial ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" jivemacro="code"&gt;&lt;P&gt;DATA &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET &amp;amp;DATA_LIB..&amp;amp;DSN_FINALS SPECIALS ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %ADDSPECIAL(&amp;amp;proj_run) ; &lt;/P&gt;&lt;P&gt;run;&amp;nbsp; &lt;/P&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 16:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55004#M11707</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-04-04T16:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: controlling flow in DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55005#M11708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tom-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That was actually a sloppy cut-and-paste on my part - there is more code, but I omitted it for simplicity, and forgot to put the RUN; in at the bottom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your idea of pulling out just the conditions in the macro just gave me another idea - I could very easily pull the code for %ADDSPECIAL out into a separate file, rather than having to maintain it in place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the great ideas!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wendy T&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 16:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/controlling-flow-in-DATA-step/m-p/55005#M11708</guid>
      <dc:creator>WendyT</dc:creator>
      <dc:date>2012-04-04T16:53:00Z</dc:date>
    </item>
  </channel>
</rss>

