<?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 Problem when calling macro variable _ORNETFL after proc netflow in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-when-calling-macro-variable-ORNETFL-after-proc-netflow/m-p/510488#M137381</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!&amp;nbsp; I am running a proc netflow process to find the shortest path.&amp;nbsp; I have a problem when I try to keep macro variable&amp;nbsp;_ORNETFL&amp;nbsp;after running proc netflow process.&amp;nbsp;&lt;SPAN&gt;_ORNETFL is generated by proc netflow process automatically.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I wrote is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro model(aa=,bb=);

data temp;
set _null_;
run;

data spath;
set _null_;
run;


proc netflow
   shortpath
   sourcenode=&amp;amp;aa
   sinknode=&amp;amp;bb   
   ARCDATA=aircost
   arcout=spath;
   tail    origin;
   head    dest;
run;

%put &amp;amp;_ORNETFL;

data a; set _null_;run;

data a; set a;
value1=&amp;amp;_ORNETFL;
run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I call the macro as:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%model(aa=BAAHE, bb=DDFG)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The log file shows that:&lt;/P&gt;&lt;PRE&gt;NOTE: Number of nodes= 777 .&lt;BR /&gt;NOTE: Number of arcs= 5681 .&lt;BR /&gt;NOTE: Number of iterations performed (neglecting any constraints)= 837 .&lt;BR /&gt;NOTE: Of these, 836 were degenerate.&lt;BR /&gt;WARNING: Flow conservation cannot be achieved at the following nodes.&lt;BR /&gt;NOTE: The amounts after each node are the sum of flows through arcs directed&lt;BR /&gt; toward that node, plus that nodes supply, minus the nodes demand, minus&lt;BR /&gt; the sum of flows through arcs directed from the node.&lt;BR /&gt; DDIA -1&lt;BR /&gt; BAAHE 1&lt;BR /&gt;ERROR: The problem is infeasible. At least one nodal flow conservation&lt;BR /&gt; constraint cannot be satisfied.&lt;BR /&gt;WARNING: The solution value reported next is associated with a solution that is&lt;BR /&gt; not both feasible and optimal.&lt;BR /&gt;NOTE: Shortest path= 95.131944444 .&lt;BR /&gt;NOTE: The data set WORK.SPATH has 5681 observations and 14 variables.&lt;BR /&gt;ERROR_STATUS=OK OPT_STATUS=STAGE_1 SHORTEST_PATH=95.131944444444&lt;BR /&gt;SOLUTION=INFEASIBLE&lt;BR /&gt;&lt;BR /&gt;NOTE: PROCEDURE NETFLOW used (Total process time):&lt;BR /&gt; real time 0.05 seconds&lt;BR /&gt; cpu time 0.02 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: The data set WORK.A has 0 observations and 0 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.A may be incomplete. When this step was stopped&lt;BR /&gt; there were 0 observations and 8 variables.&lt;BR /&gt;WARNING: Data set WORK.A was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the macro variable "_ORNETFL".&lt;BR /&gt;87 ERROR_STATUS=OK OPT_STATUS=STAGE_1 SHORTEST_PATH=95.131944444444&lt;BR /&gt; ---------- -------------&lt;BR /&gt; 22 22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **,&lt;BR /&gt; +, -, /, ;, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT,&lt;BR /&gt; MAX, MIN, NE, NG, NL, NOTIN, OR, [, ^=, {, |, ||, ~=.&lt;BR /&gt;&lt;BR /&gt;87 ! ERROR_STATUS=OK OPT_STATUS=STAGE_1 SHORTEST_PATH=95.131944444444&lt;BR /&gt;87 ! SOLUTION=INFEASIBLE&lt;BR /&gt; --------&lt;BR /&gt; 22&lt;BR /&gt;&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +,&lt;BR /&gt; -, /, ;, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT,&lt;BR /&gt; MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess it is something wrong with data step:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a; set a;
value1=&amp;amp;_ORNETFL;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I will appreciate it very much if someone could help me out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Nov 2018 16:51:03 GMT</pubDate>
    <dc:creator>daradanye</dc:creator>
    <dc:date>2018-11-05T16:51:03Z</dc:date>
    <item>
      <title>Problem when calling macro variable _ORNETFL after proc netflow</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-when-calling-macro-variable-ORNETFL-after-proc-netflow/m-p/510488#M137381</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!&amp;nbsp; I am running a proc netflow process to find the shortest path.&amp;nbsp; I have a problem when I try to keep macro variable&amp;nbsp;_ORNETFL&amp;nbsp;after running proc netflow process.&amp;nbsp;&lt;SPAN&gt;_ORNETFL is generated by proc netflow process automatically.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I wrote is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro model(aa=,bb=);

data temp;
set _null_;
run;

data spath;
set _null_;
run;


proc netflow
   shortpath
   sourcenode=&amp;amp;aa
   sinknode=&amp;amp;bb   
   ARCDATA=aircost
   arcout=spath;
   tail    origin;
   head    dest;
run;

%put &amp;amp;_ORNETFL;

data a; set _null_;run;

data a; set a;
value1=&amp;amp;_ORNETFL;
run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I call the macro as:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%model(aa=BAAHE, bb=DDFG)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The log file shows that:&lt;/P&gt;&lt;PRE&gt;NOTE: Number of nodes= 777 .&lt;BR /&gt;NOTE: Number of arcs= 5681 .&lt;BR /&gt;NOTE: Number of iterations performed (neglecting any constraints)= 837 .&lt;BR /&gt;NOTE: Of these, 836 were degenerate.&lt;BR /&gt;WARNING: Flow conservation cannot be achieved at the following nodes.&lt;BR /&gt;NOTE: The amounts after each node are the sum of flows through arcs directed&lt;BR /&gt; toward that node, plus that nodes supply, minus the nodes demand, minus&lt;BR /&gt; the sum of flows through arcs directed from the node.&lt;BR /&gt; DDIA -1&lt;BR /&gt; BAAHE 1&lt;BR /&gt;ERROR: The problem is infeasible. At least one nodal flow conservation&lt;BR /&gt; constraint cannot be satisfied.&lt;BR /&gt;WARNING: The solution value reported next is associated with a solution that is&lt;BR /&gt; not both feasible and optimal.&lt;BR /&gt;NOTE: Shortest path= 95.131944444 .&lt;BR /&gt;NOTE: The data set WORK.SPATH has 5681 observations and 14 variables.&lt;BR /&gt;ERROR_STATUS=OK OPT_STATUS=STAGE_1 SHORTEST_PATH=95.131944444444&lt;BR /&gt;SOLUTION=INFEASIBLE&lt;BR /&gt;&lt;BR /&gt;NOTE: PROCEDURE NETFLOW used (Total process time):&lt;BR /&gt; real time 0.05 seconds&lt;BR /&gt; cpu time 0.02 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: The data set WORK.A has 0 observations and 0 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.A may be incomplete. When this step was stopped&lt;BR /&gt; there were 0 observations and 8 variables.&lt;BR /&gt;WARNING: Data set WORK.A was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the macro variable "_ORNETFL".&lt;BR /&gt;87 ERROR_STATUS=OK OPT_STATUS=STAGE_1 SHORTEST_PATH=95.131944444444&lt;BR /&gt; ---------- -------------&lt;BR /&gt; 22 22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **,&lt;BR /&gt; +, -, /, ;, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT,&lt;BR /&gt; MAX, MIN, NE, NG, NL, NOTIN, OR, [, ^=, {, |, ||, ~=.&lt;BR /&gt;&lt;BR /&gt;87 ! ERROR_STATUS=OK OPT_STATUS=STAGE_1 SHORTEST_PATH=95.131944444444&lt;BR /&gt;87 ! SOLUTION=INFEASIBLE&lt;BR /&gt; --------&lt;BR /&gt; 22&lt;BR /&gt;&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +,&lt;BR /&gt; -, /, ;, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT,&lt;BR /&gt; MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess it is something wrong with data step:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a; set a;
value1=&amp;amp;_ORNETFL;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I will appreciate it very much if someone could help me out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 16:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-when-calling-macro-variable-ORNETFL-after-proc-netflow/m-p/510488#M137381</guid>
      <dc:creator>daradanye</dc:creator>
      <dc:date>2018-11-05T16:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem when calling macro variable _ORNETFL after proc netflow</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-when-calling-macro-variable-ORNETFL-after-proc-netflow/m-p/510494#M137385</link>
      <description>&lt;P&gt;Without quotes around the value then the variable is treated as NUMERIC and the text held in the macro variable is obviously not numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; a1&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token keyword"&gt;&amp;nbsp;&amp;nbsp; set&lt;/SPAN&gt; a&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; value1&lt;SPAN class="token operator"&gt;= "&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;_ORNETFL"&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;might help. If the variable VALUE1 exists in data set a and is numeric you will continue to get errors. If the variable Value1 exists and is character it might not be long enough to hold the complete text.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Note that frequent use of the structure;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Data a;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&amp;nbsp; set a;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;WILL cause problems with corrupted data sets, missing values or variables or other problems hard to debug, especially when buried in a macro. Since you are basically clearing set A with the previous data a; set _null_;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;perhaps just &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;data a;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&amp;nbsp; value1&lt;SPAN class="token operator"&gt;= "&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;_ORNETFL";&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 17:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-when-calling-macro-variable-ORNETFL-after-proc-netflow/m-p/510494#M137385</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-05T17:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem when calling macro variable _ORNETFL after proc netflow</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-when-calling-macro-variable-ORNETFL-after-proc-netflow/m-p/510760#M137459</link>
      <description>&lt;P&gt;I see two problems with you code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One is the construction "data a;set _null_;run;" which creates a completely empty table (no obs, no vars - who taught you that? you should ask for your money back!). When you follow that with "data a;set a;...." then the code following "set a;" will not get executed - the execution stops after trying to read an obs from A and finding none. So you will get another table with no obs (but maybe some variables, if the code that follows declares some).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other problem is that the _ORNETFL macro variable does not contain a numeric value, so if you want to assign it in a data step, you must quote it. Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
  value1="&amp;amp;_ORNETFL";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That should at least store the value in the table A (which will now have one obs and one variable).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you are doing this because you cannot access the _ORNETFL macro variable outside your macro, as it probably ends up getting declared %LOCAL to the macro, unless otherwise defined. If you want to access it outside the macro, you could also put a "%GLOBAL _ORNETFL;" statement in the top of your macro, or you could define it before calling the macro. Meaning that you could also put a "%LOCAL _ORNETFL;" statement in a calling macro (if there is one). Or simply define it in the global environment before calling the macro, e.g.:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let _ORNETFL=;
%model(aa=BAAHE, bb=DDFG);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That way, it will stay blank if your macro call for some reason fails.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 14:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-when-calling-macro-variable-ORNETFL-after-proc-netflow/m-p/510760#M137459</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-11-06T14:42:37Z</dc:date>
    </item>
  </channel>
</rss>

