<?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: macros in SAS Jupyter in Developers</title>
    <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457789#M253</link>
    <description>added log (?) to original code. the suggested alternative code produces the same ...</description>
    <pubDate>Thu, 26 Apr 2018 15:21:53 GMT</pubDate>
    <dc:creator>csetzkorn</dc:creator>
    <dc:date>2018-04-26T15:21:53Z</dc:date>
    <item>
      <title>macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457744#M245</link>
      <description>&lt;P&gt;Hope this is the correct location for this question. It appears that I cannot run macros in Jupyter:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2016/04/24/how-to-run-sas-programs-in-jupyter-notebook" target="_blank"&gt;https://blogs.sas.com/content/sasdummy/2016/04/24/how-to-run-sas-programs-in-jupyter-notebook&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro SomeExcitingMacro(OriginName);
	PROC SGPLOT DATA=SASHELP.cars(where=(Origin = "&amp;amp;OriginName."));
	  VBOX Invoice
	  / category = DriveTrain nooutliers;
	  yaxis min=0 max=100000;
	RUN;
%mend SomeExcitingMacro;

proc sql;
	create table LoopData as
	select 
		distinct Origin
	from SASHELP.cars
	;
quit;

data _null_;
  set LoopData;
  call execute('%nrstr(%SomeExcitingMacro('||Origin||'))');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;PS:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;6                                                          The SAS System                             16:14 Thursday, April 26, 2018

39         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
39       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
40         
41             PROC SGPLOT DATA=SASHELP.cars(where=(Origin = "&amp;amp;OriginName."));
WARNING: Apparent symbolic reference ORIGINNAME not resolved.
42         	  VBOX Invoice
43         	  / category = DriveTrain nooutliers;
44         	  yaxis min=0 max=100000;
45         	RUN;

NOTE: There were 0 observations read from the data set SASHELP.CARS.
      WHERE 0 /* an obviously FALSE WHERE clause */ ;
NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              243.46k
      OS Memory           19864.00k
      Timestamp           26/04/2018 04:14:56 PM
      Step Count                        6  Switch Count  40
      Page Faults                       0
      Page Reclaims                     99
      Page Swaps                        0
      Voluntary Context Switches        105
      Involuntary Context Switches      2
      Block Input Operations            0
      Block Output Operations           0
      

ERROR: No matching %MACRO statement for this %MEND statement.
46         %mend SomeExcitingMacro;
47         
48         proc sql;
49         	create table LoopData as
50         	select
51         		distinct Origin
52         	from SASHELP.cars
53         	;
NOTE: Compression was disabled for data set WORK.LOOPDATA because compression overhead would increase the size of the data set.
NOTE: Table WORK.LOOPDATA created, with 3 rows and 1 columns.

54         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      user cpu time       0.01 seconds
      system cpu time     0.01 seconds
      memory              5328.46k
      OS Memory           24988.00k
      Timestamp           26/04/2018 04:14:56 PM
      Step Count                        7  Switch Count  48
      Page Faults                       0
      Page Reclaims                     431
      Page Swaps                        0
      Voluntary Context Switches        136
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           136
      

55         
56         data _null_;
57           set LoopData;
58           call execute('%nrstr(%SomeExcitingMacro('||Origin||'))');
59         run;

NOTE: There were 3 observations read from the data set WORK.LOOPDATA.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.01 seconds
      memory              921.87k
      OS Memory           21144.00k
      Timestamp           26/04/2018 04:14:56 PM
      Step Count                        8  Switch Count  32
      Page Faults                       0
      Page Reclaims                     314
      Page Swaps                        0
      Voluntary Context Switches        73
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           0
      

NOTE: CALL EXECUTE generated line.
WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
NOTE: Line generated by the CALL EXECUTE routine.
1         + %SomeExcitingMacro(Asia  )
            _
            180
ERROR 180-322: Statement is not valid or it is used out of proper order.

2         + %SomeExcitingMacro(Europe)
3         + %SomeExcitingMacro(USA   )
60         
61         ;

61       !  *';*";*/;ods html5 (id=saspy_internal) close;ods listing;
62         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 15:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457744#M245</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T15:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457752#M246</link>
      <description>&lt;P&gt;And what does the log say?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 13:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457752#M246</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-26T13:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457753#M247</link>
      <description>&lt;P&gt;First off, you really need to understand what macros, and commands are used for an when to use them as %nrstr is really not needed here.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrobound"&gt;%macro&lt;/SPAN&gt; someexcitingmacro&lt;SPAN class="token punctuation"&gt;(o&lt;/SPAN&gt;riginname&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;  proc sgplot data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=sashelp&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;cars;&lt;BR /&gt;    &lt;SPAN class="token statement"&gt;where o&lt;/SPAN&gt;rigin&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"&amp;amp;originname.";&lt;BR /&gt;&lt;/SPAN&gt;    vbox invoice &lt;SPAN class="token operator"&gt;/ &lt;/SPAN&gt;category&lt;SPAN class="token operator"&gt;=d&lt;/SPAN&gt;rivetrain nooutliers&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;    yaxis&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;min&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;max&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;100000&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token punctuation"&gt;  run;&lt;/SPAN&gt;
&lt;SPAN class="token macrobound"&gt;%mend&lt;/SPAN&gt; someexcitingmacro&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  create &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; loopdata as
&lt;SPAN class="token statement"&gt;  select&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;distinct&lt;/SPAN&gt; origin
&lt;SPAN class="token keyword"&gt;  from&lt;/SPAN&gt;   sashelp&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;cars&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; _null_&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; loopdata&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  call &lt;SPAN class="token keyword"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'%SomeExcitingMacro('&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;||o&lt;/SPAN&gt;rigin&lt;SPAN class="token operator"&gt;||&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;');'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now this program should work.&amp;nbsp; However that being said there is no need to utilise macro at all.&amp;nbsp; SAS provides the structure to loop over variables within a procedure itself.&amp;nbsp; It is called by grouping and is very powerful:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;proc sgplot data=sashelp.cars;&lt;BR /&gt; by origin;&lt;BR /&gt; title "By group=#byval1";&lt;BR /&gt; vbox invoice / category=drivetrain nooutliers;&lt;BR /&gt; yaxis min=0 max=100000;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;This will create one vbox output for each distinct origin in the dataset cars.&amp;nbsp; If you only need specific ones add a where clause.&amp;nbsp; This type of code is far simpler to write and maintain.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 13:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457753#M247</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-26T13:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457758#M248</link>
      <description>Thanks this was just a POC.</description>
      <pubDate>Thu, 26 Apr 2018 14:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457758#M248</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T14:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457759#M249</link>
      <description>&lt;P&gt;Still error in Jupyter Notebook:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;No such macro: 'someexcitingmacro(originname);'

Available macros:
    System:
        renumber-cells
    Learned:&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Apr 2018 14:15:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457759#M249</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T14:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457763#M250</link>
      <description>&lt;P&gt;Please post your full code and/or log.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 14:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457763#M250</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-26T14:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457768#M251</link>
      <description>Sorry but which log do you refer to. The log4net one generated by java as jupyter uses iom?&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Apr 2018 14:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457768#M251</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T14:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457779#M252</link>
      <description>&lt;P&gt;You can use this extension to get the SAS log:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sassoftware/sas_kernel/tree/master/sas_kernel/nbextensions" target="_blank"&gt;https://github.com/sassoftware/sas_kernel/tree/master/sas_kernel/nbextensions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 15:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457779#M252</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-26T15:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457789#M253</link>
      <description>added log (?) to original code. the suggested alternative code produces the same ...</description>
      <pubDate>Thu, 26 Apr 2018 15:21:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457789#M253</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T15:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457801#M254</link>
      <description>&lt;P&gt;You do not have the code as I present it, you are missing:&lt;/P&gt;
&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrobound"&gt;%macro&lt;/SPAN&gt; someexcitingmacro&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;originname&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;At least.&amp;nbsp; This is what the log is telling you, there is no macro variable called originname, and there is no macro definition for someexcitingmacro, as you do not have the above line.&amp;nbsp; Please use my code in full.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 16:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457801#M254</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-26T16:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457802#M255</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99946"&gt;@csetzkorn&lt;/a&gt; wrote:&lt;BR /&gt;added log (?) to original code. the suggested alternative code produces the same ...&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note sure of timing on when posted but in the posted log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your "code used" does not show the ODS Listing; Ods html5 ... that appears in the log.&lt;/P&gt;
&lt;P&gt;The LOG does NOT show the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro SomeExcitingMacro(OriginName);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;And the error about the not matching %macro is likely the result of no such line submitted.&lt;/P&gt;
&lt;P&gt;So the macro did not compile . Then when call execute creates the call you get all those&lt;/P&gt;
&lt;PRE&gt;WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
&lt;/PRE&gt;
&lt;P&gt;because the macro doesn't exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generic hint: move as much code outside of ODS destination/ ods destination close statements as practical. That way only the actual output generation is involved. Test the macros and data generation separately.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 16:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457802#M255</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-26T16:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457836#M256</link>
      <description>&lt;P&gt;As I said I submitted your code as well. The screenshot is below. I get similar error logs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;6                                                          The SAS System                             18:24 Thursday, April 26, 2018

39         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
39       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
40         
41           proc sgplot data=sashelp.cars;    where origin="&amp;amp;originname.";    vbox invoice / category=drivetrain nooutliers;
WARNING: Apparent symbolic reference ORIGINNAME not resolved.
42             yaxis min=0 max=100000;
43           run;

NOTE: There were 0 observations read from the data set SASHELP.CARS.
      WHERE 0 /* an obviously FALSE WHERE clause */ ;
NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              242.03k
      OS Memory           19864.00k
      Timestamp           26/04/2018 06:24:26 PM
      Step Count                        6  Switch Count  32
      Page Faults                       0
      Page Reclaims                     104
      Page Swaps                        0
      Voluntary Context Switches        72
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           0
      

ERROR: No matching %MACRO statement for this %MEND statement.
44         %mend someexcitingmacro;
45         
46         proc sql;
47           create table loopdata as
48           select distinct origin
49           from   sashelp.cars;
NOTE: Compression was disabled for data set WORK.LOOPDATA because compression overhead would increase the size of the data set.
NOTE: Table WORK.LOOPDATA created, with 3 rows and 1 columns.

50         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.01 seconds
      memory              5328.46k
      OS Memory           24988.00k
      Timestamp           26/04/2018 06:24:26 PM
      Step Count                        7  Switch Count  40
      Page Faults                       0
      Page Reclaims                     424
      Page Swaps                        0
      Voluntary Context Switches        104
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           144
      

51         
52         data _null_;
53           set loopdata;
54           call execute('%SomeExcitingMacro('||origin||');');
55         run;

WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
NOTE: There were 3 observations read from the data set WORK.LOOPDATA.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      user cpu time       0.01 seconds
      system cpu time     0.00 seconds
      memory              925.21k
      OS Memory           21144.00k
      Timestamp           26/04/2018 06:24:26 PM
      Step Count                        8  Switch Count  38
      Page Faults                       0
      Page Reclaims                     313
      Page Swaps                        0
      Voluntary Context Switches        96
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           0
      

NOTE: CALL EXECUTE generated line.
WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
NOTE: Line generated by the CALL EXECUTE routine.
1         + %SomeExcitingMacro(Asia  );
            _
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
NOTE: Line generated by the CALL EXECUTE routine.
2         + %SomeExcitingMacro(Europe);
            _
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro SOMEEXCITINGMACRO not resolved.
NOTE: Line generated by the CALL EXECUTE routine.
3         + %SomeExcitingMacro(USA   );
            _
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

56         
57         ods html5 (id=saspy_internal) close;ods listing;
58         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My current conclusion is that Jupyter does not work with macros or maybe I am missing something.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20181i1319B4C02D1A3D14/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 17:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457836#M256</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T17:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457881#M257</link>
      <description>&lt;P&gt;Sorry, the log you post is &lt;U&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/U&gt; of the code I provided.&amp;nbsp; Please point me to exactly where in the log:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token number"&gt;39&lt;/SPAN&gt;         &lt;SPAN class="token statement"&gt;ods&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;listing&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;close&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;ods&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;html5&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;saspy_internal&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;file&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;_tomods1 &lt;SPAN class="token procnames"&gt;options&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;bitmap_mode&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'inline'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; device&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;svg&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;ods&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;graphics&lt;/SPAN&gt; on &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;
&lt;SPAN class="token number"&gt;39&lt;/SPAN&gt;       &lt;SPAN class="token operator"&gt;!&lt;/SPAN&gt;  outputfmt&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;png&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;NOTE&lt;/SPAN&gt;: Writing &lt;SPAN class="token keyword"&gt;HTML5&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;SASPY_INTERNAL&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; Body &lt;SPAN class="token statement"&gt;file&lt;/SPAN&gt;: _TOMODS1
&lt;SPAN class="token number"&gt;40&lt;/SPAN&gt;         
&lt;SPAN class="token number"&gt;41&lt;/SPAN&gt;           &lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sgplot&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;sashelp&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;cars&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;    &lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; origin&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"&amp;amp;originname."&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;    vbox invoice &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; category&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;drivetrain nooutliers&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
WARNING: Apparent symbolic reference ORIGINNAME &lt;SPAN class="token operator"&gt;not&lt;/SPAN&gt; resolved&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="token number"&gt;42&lt;/SPAN&gt;             &lt;SPAN class="token statement"&gt;yaxis&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;min&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;max&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;100000&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token number"&gt;43&lt;/SPAN&gt;           &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Where I can find the string:&lt;/P&gt;
&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrobound"&gt;%macro&lt;/SPAN&gt; someexcitingmacro&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;originname&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is missing from the run, hence originname is not defined, and there is not macro start, so medn calls and error.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 18:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457881#M257</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-26T18:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457886#M258</link>
      <description>I know. The first few lines of the code in the screenshot are red. Jupyter seems to ignore them for whatever reason?! Not sure what else to do?</description>
      <pubDate>Thu, 26 Apr 2018 19:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457886#M258</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T19:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457908#M259</link>
      <description>&lt;P&gt;It doesn't make sense to have ODS statements in Jupyter because output goes into the notebook. If hte purpase is to generate external fiels, I'd say that Jupyter is not the method you'd likely want to use. Or at least it makes it harder than it needs to be.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS. Personally, I like Notebooks for presenting work, but for development it's hell.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 19:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457908#M259</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-26T19:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457915#M260</link>
      <description>I agree! TBH I am perfectly happy with EG but certain people think everything is Python/Jupyter these days. It should still be possible to use a macro in Jupyter though?!</description>
      <pubDate>Thu, 26 Apr 2018 19:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457915#M260</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T19:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457927#M261</link>
      <description>&lt;P&gt;I don't have Jupyter at the moment, but see no reason they&amp;nbsp; wouldn't work. I would test it first...here's a very simple one you can test if desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro sample_print(dsn=);

proc print data=&amp;amp;dsn; run;

%mend ;

%sample_print(dsn=sashelp.class);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Apr 2018 19:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457927#M261</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-26T19:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457936#M262</link>
      <description>&lt;P&gt;Thanks Reeza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again Jupyter marks macro code red (see screenshot below). Errors in log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SAS Connection established. Subprocess id is 8964

&amp;#12;6                                                          The SAS System                             20:53 Thursday, April 26, 2018

39         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
39       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
40         
41         
42         proc print data=&amp;amp;dsn; run;
                           _
                           22
                           200
WARNING: Apparent symbolic reference DSN not resolved.
ERROR: File WORK.DSN.DATA does not exist.

ERROR 22-322: Expecting a name.  

ERROR 200-322: The symbol is not recognized and will be ignored.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              72.71k
      OS Memory           19608.00k
      Timestamp           26/04/2018 08:53:52 PM
      Step Count                        6  Switch Count  38
      Page Faults                       0
      Page Reclaims                     84
      Page Swaps                        0
      Voluntary Context Switches        96
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           0
      
ERROR: No matching %MACRO statement for this %MEND statement.
WARNING: Apparent invocation of macro SAMPLE_PRINT not resolved.
43         
44         %mend ;
45         
46         %sample_print(dsn=sashelp.class);
47         
48         ods html5 (id=saspy_internal) close;ods listing;
49         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 350px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20191iB632700155CF484F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 19:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457936#M262</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T19:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457947#M263</link>
      <description>&lt;P&gt;The coloring might be coming from settings for the editor.&lt;/P&gt;
&lt;P&gt;See the capture from my editor. The pink background is for macro code, the dark pink with white background is for the macro language keywords.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 289px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20192i0A5B56FACC769D80/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you copy code directly from some sources you sometimes get non-displayed characters that interfere with the SAS language interpreter. Sometimes the results are&amp;nbsp;pretty bizarre depending on which code locations they occur.&amp;nbsp;So did any of those %macro statements originate as copy and paste or did you type them directly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something else to try might be to put some code before the macro definition that doesn't really do anything and see if the same issue repeats. Something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 20:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457947#M263</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-26T20:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: macros in SAS Jupyter</title>
      <link>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457953#M264</link>
      <description>&lt;P&gt;This works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
run;

%macro SomeExcitingMacro(OriginName);
	PROC SGPLOT DATA=SASHELP.cars(where=(Origin = "&amp;amp;OriginName."));
	VBOX Invoice
	/ category = DriveTrain nooutliers;
	yaxis min=0 max=100000;
	RUN;
%mend SomeExcitingMacro;

proc sql;
	create table LoopData as
	select 
		distinct Origin
	from SASHELP.cars
	;
quit;

data _null_;
set LoopData;
call execute('%nrstr(%SomeExcitingMacro('||Origin||'))');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The first lines of code seem to be necessary to get the macro to work.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 20:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/macros-in-SAS-Jupyter/m-p/457953#M264</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-04-26T20:43:56Z</dc:date>
    </item>
  </channel>
</rss>

