<?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: Trying to call TableN macro for Table 1, either getting errors or no output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927852#M365092</link>
    <description>&lt;P&gt;What did the LOG show?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you compile the macro in the session prior to the call? You have to execute the code with the macro definition if you do not place the macro code file in a place SAS looks for macros (autocall library).&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2024 14:51:57 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-05-10T14:51:57Z</dc:date>
    <item>
      <title>Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927843#M365086</link>
      <description>&lt;P&gt;As I recently posted &lt;A href="https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-and-Proc-Freq-chi-sq-to-create-quot-Table-1/m-p/927765/highlight/false#M365073" target="_self"&gt;here&lt;/A&gt;, I'm trying to create Table 1 for a research journal article. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; pointed me to the Table 1 macro "&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Demographic-Table-and-Subgroup-Summary-Macro-TABLEN/ta-p/634030" target="_self"&gt;TableN&lt;/A&gt;" and it looks like exactly what I need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I downloaded the macro and ran it, and then I tried to call it based on the example provided. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Example macro call*/
/*%tablen(data=example, by=arm, 
     var=age date_on sex race1 smoke_st num_met,
     type=1 3 2, outdoc=~/ibm/example1.rtf);*/

/*My version*/
%tablen(data=have, by=TM_group, 
     var=DEM_AGE DEM_SEX,
     type=2 2, outdoc="C:\data_output\test.rtf);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I got an error after "by TM_group": ERROR: All positional parameters must precede keyword parameters. I looked up the error and it has something to do with the commas between the parameters. After some trial and error of deleting commas, I got it to run without error, but it doesn't produce any output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample data is provided below:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data have;
  infile datalines dsd dlm=',' truncover;
  input DEM_AGE DEM_SEX cohort_flag TM_group;
datalines;
3,1,1,0
2,1,1,1
3,2,1,1
3,2,1,1
3,2,1,0
2,2,1,1
2,1,1,1
3,1,1,1
2,1,1,1
3,2,1,0
2,1,1,0
2,2,1,1
3,2,1,0
2,2,0,
3,2,1,1
3,2,1,1
3,1,1,0
3,2,1,0
2,1,1,0
3,1,1,1
3,2,1,1
3,2,1,0
3,2,1,1
3,2,1,1
3,2,1,1
; RUN;

proc format library=temp;

value age2grp
1='1:Age Group &amp;lt;65'
2='2:Age Group [65,75)'
3='3:Age Group &amp;gt;=75'
.='Inapplicable/Missing';

value sex
.='Inapplicable/Missing'
1='1:Male'
2='2:Female'
value yesfmt
1='1:Yes'
2='2:No'
.='Inapplicable/Missing'
;
RUN;


&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 14:14:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927843#M365086</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2024-05-10T14:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927845#M365087</link>
      <description>The value (path) passed to parameter outdoc has unbalanced quotes.&lt;BR /&gt;I assume you shouldn’t use any quotes at all.</description>
      <pubDate>Fri, 10 May 2024 14:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927845#M365087</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-10T14:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927846#M365088</link>
      <description>&lt;P&gt;The sort of errors caused by unbalanced quotes passed as macro parameters likely means that your SAS session may have issues with getting things to execute. May want to save the code (with corrections for quotes, i.e. none) and then restart your SAS session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 14:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927846#M365088</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-10T14:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927850#M365090</link>
      <description>&lt;P&gt;I closed the SAS session, opened a new SAS session, reran the macro, and then tried the macro call without quotes for the outdoc. I also tried making sure the quotes were balanced. In both cases, there were no errors but also no output.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 14:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927850#M365090</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2024-05-10T14:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927852#M365092</link>
      <description>&lt;P&gt;What did the LOG show?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you compile the macro in the session prior to the call? You have to execute the code with the macro definition if you do not place the macro code file in a place SAS looks for macros (autocall library).&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 14:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927852#M365092</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-10T14:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927854#M365094</link>
      <description>&lt;P&gt;When I opened the new SAS session, the first thing I did was rerun the macro syntax. I reviewed the log and there were no errors. However, now that I'm taking a closer look at it, I also notice there are no notes or warnings either. In effect, the log simply shows all the syntax that was submitted. Could that indicate that the macro didn't actually compile for some reason?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a check, I opened a 2nd SAS session and ran just the macro call. As expected, it gave me a warning that "macro TABLEN not resolved".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the call after the macro has already been run, the log simply shows the macro call, without any errors, notes, or warnings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems like the SAS knows that the macro is there, so I can call it without a warning or error. But the macro itself isn't actually executing for some reason.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 15:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927854#M365094</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2024-05-10T15:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927858#M365095</link>
      <description>&lt;P&gt;This worked for me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tableN url 
 'https://gist.githubusercontent.com/statgeek/b55d964c99975c2ba23fa771afe616bc/raw/b30d55caf6ec4028f5afed3b260ce86b50419ddb/tablen.sas';

%include tableN;

proc format;

value age2grp
1='1:Age Group &amp;lt;65'
2='2:Age Group [65,75)'
3='3:Age Group &amp;gt;=75'
.='Inapplicable/Missing';

value sex
.='Inapplicable/Missing'
1='1:Male'
2='2:Female';

value yesfmt
1='1:Yes'
2='2:No'
.='Inapplicable/Missing'
;
RUN;

data have;
  infile datalines dsd dlm=',' truncover;
  input DEM_AGE DEM_SEX cohort_flag TM_group;
  format dem_age age2grp. dem_sex sex.;
datalines;
3,1,1,0
2,1,1,1
3,2,1,1
3,2,1,1
3,2,1,0
2,2,1,1
2,1,1,1
3,1,1,1
2,1,1,1
3,2,1,0
2,1,1,0
2,2,1,1
3,2,1,0
2,2,0,
3,2,1,1
3,2,1,1
3,1,1,0
3,2,1,0
2,1,1,0
3,1,1,1
3,2,1,1
3,2,1,0
3,2,1,1
3,2,1,1
3,2,1,1
; RUN;




%tablen(data=have, by=TM_group, 
     var=DEM_AGE DEM_SEX,
     type=2 2, outdoc=/home/fkhurshed/Demo1/TableNExample_delete.rtf);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Reeza_0-1715354418790.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96410i0C3384C4ED5CF018/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Reeza_0-1715354418790.png" alt="Reeza_0-1715354418790.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change your outdoc in the code above and try again (everything else can stay the same).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/43822"&gt;@Wolverine&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;As I recently posted &lt;A href="https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-and-Proc-Freq-chi-sq-to-create-quot-Table-1/m-p/927765/highlight/false#M365073" target="_self"&gt;here&lt;/A&gt;, I'm trying to create Table 1 for a research journal article. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; pointed me to the Table 1 macro "&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Demographic-Table-and-Subgroup-Summary-Macro-TABLEN/ta-p/634030" target="_self"&gt;TableN&lt;/A&gt;" and it looks like exactly what I need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I downloaded the macro and ran it, and then I tried to call it based on the example provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Example macro call*/
/*%tablen(data=example, by=arm, 
     var=age date_on sex race1 smoke_st num_met,
     type=1 3 2, outdoc=~/ibm/example1.rtf);*/

/*My version*/
%tablen(data=have, by=TM_group, 
     var=DEM_AGE DEM_SEX,
     type=2 2, outdoc="C:\data_output\test.rtf);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I got an error after "by TM_group": ERROR: All positional parameters must precede keyword parameters. I looked up the error and it has something to do with the commas between the parameters. After some trial and error of deleting commas, I got it to run without error, but it doesn't produce any output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample data is provided below:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data have;
  infile datalines dsd dlm=',' truncover;
  input DEM_AGE DEM_SEX cohort_flag TM_group;
datalines;
3,1,1,0
2,1,1,1
3,2,1,1
3,2,1,1
3,2,1,0
2,2,1,1
2,1,1,1
3,1,1,1
2,1,1,1
3,2,1,0
2,1,1,0
2,2,1,1
3,2,1,0
2,2,0,
3,2,1,1
3,2,1,1
3,1,1,0
3,2,1,0
2,1,1,0
3,1,1,1
3,2,1,1
3,2,1,0
3,2,1,1
3,2,1,1
3,2,1,1
; RUN;

proc format library=temp;

value age2grp
1='1:Age Group &amp;lt;65'
2='2:Age Group [65,75)'
3='3:Age Group &amp;gt;=75'
.='Inapplicable/Missing';

value sex
.='Inapplicable/Missing'
1='1:Male'
2='2:Female'
value yesfmt
1='1:Yes'
2='2:No'
.='Inapplicable/Missing'
;
RUN;


&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 15:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927858#M365095</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-05-10T15:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927860#M365096</link>
      <description>&lt;P&gt;You should get something in the log indicating compilation such as:&lt;/P&gt;
&lt;PRE&gt;60   %macro dummy();
61      proc print data=sashelp.class;
62      run;
63   %mend;
NOTE: The macro DUMMY completed compilation without errors.
      5 instructions 92 bytes.
&lt;/PRE&gt;
&lt;P&gt;Which version did you download and use?&lt;/P&gt;
&lt;P&gt;When I compile the version in tablen_05102022.sas I get:&lt;/P&gt;
&lt;PRE&gt;NOTE: The macro TABLEN completed compilation without errors.
      7334 instructions 258444 bytes.
&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 May 2024 15:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927860#M365096</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-10T15:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927863#M365097</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You should get something in the log indicating compilation such as:&lt;/P&gt;
&lt;PRE&gt;60   %macro dummy();
61      proc print data=sashelp.class;
62      run;
63   %mend;
NOTE: The macro DUMMY completed compilation without errors.
      5 instructions 92 bytes.
&lt;/PRE&gt;
&lt;P&gt;Which version did you download and use?&lt;/P&gt;
&lt;P&gt;When I compile the version in tablen_05102022.sas I get:&lt;/P&gt;
&lt;PRE&gt;NOTE: The macro TABLEN completed compilation without errors.
      7334 instructions 258444 bytes.
&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm also using tablen_05102022.sas, but I am definitely not getting those notes in the log.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 15:29:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927863#M365097</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2024-05-10T15:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927864#M365098</link>
      <description>&lt;P&gt;I tried using the filename statement and getting the macro .sas file from the URL, but the result was the same. The macro still isn't compiling or executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I usually use a temp directory for my working files, so I added a LIBNAME statement. The only note I get in the log is that the Libref TEMP was successfully assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the entire log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M4)
      Licensed to XXXXXXXX.
NOTE: This session is executing on the X64_10PRO  platform.

NOTE: Updated analytical products:

      SAS/STAT 14.2
      SAS/ETS 14.2
      SAS/OR 14.2
      SAS/IML 14.2
      SAS/QC 14.2

NOTE: Additional host information:

X64_10PRO WIN 10.0.22621  Workstation

NOTE: SAS initialization used:
      real time           1.13 seconds
      cpu time            0.18 seconds

1    LIBNAME temp "C:\Users\XXXXXXXX\SAStemp";
NOTE: Libref TEMP was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\XXXXXXXX\SAStemp
2
3    filename tableN url
4     'https://gist.githubusercontent.com/statgeek/b55d964c99975c2ba23fa771afe616bc/raw/b30d55caf
4  ! 6ec4028f5afed3b260ce86b50419ddb/tablen.sas';
5
6    %include tableN;
4187
4188
4189   %tablen(data=temp.fall_summ_allyrs_cohort by TM_group,
4190       var = DEM_SEX DEM_AGE,
4191       type= 2 2, outdoc="C:\Users\XXXXXXXX\test.rtf";
4192   RUN;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 May 2024 15:40:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927864#M365098</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2024-05-10T15:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927867#M365099</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/43822"&gt;@Wolverine&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You should get something in the log indicating compilation such as:&lt;/P&gt;
&lt;PRE&gt;60   %macro dummy();
61      proc print data=sashelp.class;
62      run;
63   %mend;
NOTE: The macro DUMMY completed compilation without errors.
      5 instructions 92 bytes.
&lt;/PRE&gt;
&lt;P&gt;Which version did you download and use?&lt;/P&gt;
&lt;P&gt;When I compile the version in tablen_05102022.sas I get:&lt;/P&gt;
&lt;PRE&gt;NOTE: The macro TABLEN completed compilation without errors.
      7334 instructions 258444 bytes.
&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm also using tablen_05102022.sas, but I am definitely not getting those notes in the log.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What size is your tablen_05102022.sas file? Is the last line in file %mend; ?&lt;/P&gt;
&lt;P&gt;I wonder if you may have had a hiccup when downloading the file and have an incomplete version.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 15:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927867#M365099</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-10T15:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927870#M365100</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/43822"&gt;@Wolverine&lt;/a&gt;&amp;nbsp;Using below code I'm getting a result with your sample data.&lt;/P&gt;
&lt;P&gt;Code run locally on a Windows laptop with SAS9.4M8&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if you execute this code in your environment in a fresh new session? Only bit you need to end is the path "c:\temp\...." to something that's suitable for your environment.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines dsd dlm=',' truncover;
  input DEM_AGE DEM_SEX cohort_flag TM_group;
  datalines;
3,1,1,0
2,1,1,1
3,2,1,1
3,2,1,1
3,2,1,0
2,2,1,1
2,1,1,1
3,1,1,1
2,1,1,1
3,2,1,0
2,1,1,0
2,2,1,1
3,2,1,0
2,2,0,
3,2,1,1
3,2,1,1
3,1,1,0
3,2,1,0
2,1,1,0
3,1,1,1
3,2,1,1
3,2,1,0
3,2,1,1
3,2,1,1
3,2,1,1
;
RUN;

proc format library=temp;
  value age2grp
    1='1:Age Group &amp;lt;65'
    2='2:Age Group [65,75)'
    3='3:Age Group &amp;gt;=75'
    .='Inapplicable/Missing'
  ;
  value sex
    1='1:Male'
    2='2:Female'
    .='Inapplicable/Missing'
  ;
  value yesfmt
    1='1:Yes'
    2='2:No'
    .='Inapplicable/Missing'
  ;
RUN;

filename tableN url 'https://communities.sas.com/kntur85557/attachments/kntur85557/library/4477/5/tablen_05102022.sas';
/*filename tableN url 'https://communities.sas.com/kntur85557/attachments/kntur85557/library/4477/5/tablen_032020_pharmasug.sas';*/
/*filename tableN url 'https://gist.githubusercontent.com/statgeek/b55d964c99975c2ba23fa771afe616bc/raw/b30d55caf6ec4028f5afed3b260ce86b50419ddb/tablen.sas';*/
%include tableN /source2;

filename mprint "c:\temp\gencode.sas";
options mprint mfile;
%tablen(
  data=have
  ,by=TM_group
  ,var=DEM_AGE DEM_SEX
  ,type=2 2, outdoc=C:\temp\test.rtf
  );

options nomfile;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1715356340026.png" style="width: 698px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96411iBFC54B4F2DB2A388/image-dimensions/698x178?v=v2" width="698" height="178" role="button" title="Patrick_0-1715356340026.png" alt="Patrick_0-1715356340026.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code executes with Warnings!&lt;/P&gt;
&lt;P&gt;It appears the code the macro generates changes the environment - like ODS LISTING CLOSE;&lt;/P&gt;
&lt;P&gt;Below macro call with option MFILE set will write the generated code to file .../gencode.sas which you could use to further investigate what's happening.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mprint "c:\temp\gencode.sas";
options mprint mfile;
%tablen(
  data=have
  ,by=TM_group
  ,var=DEM_AGE DEM_SEX
  ,type=2 2, outdoc=C:\temp\test.rtf
  );
options nomfile;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 16:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927870#M365100</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-10T16:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927871#M365101</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/43822"&gt;@Wolverine&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;4189   %tablen(data=temp.fall_summ_allyrs_cohort by TM_group,
4190       var = DEM_SEX DEM_AGE,
4191       type= 2 2, outdoc="C:\Users\XXXXXXXX\test.rtf"&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;
4192   RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There is no need for a RUN statement, but the closing parenthesis of the macro call must not be replaced by a semicolon.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 15:59:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927871#M365101</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-10T15:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927880#M365104</link>
      <description>&lt;P&gt;This works! It worked with the sample data, so I removed the datalines and added my real data to the data step and that works too! &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I need to restrict to certain cases in the file. Previously, I used "Where cohort_flag = 1;", but I don't know where to put that in this code.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 16:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927880#M365104</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2024-05-10T16:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927885#M365105</link>
      <description>One option:&lt;BR /&gt;…(data=have(where=(cohort_flag=1)),….</description>
      <pubDate>Fri, 10 May 2024 16:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927885#M365105</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-10T16:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927888#M365106</link>
      <description>&lt;P&gt;I'm getting an error that the dataset does not exist. It's reading it as if the name of the dataset is "have(where=(cohort_flag=1))". Here's the relevant portion of the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%tablen(
    data=have(where=(cohort_flag=1))
,by=TM_group&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 16:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927888#M365106</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2024-05-10T16:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927903#M365110</link>
      <description>Create a view of that data set and use it instead of trying to modify the macro. &lt;BR /&gt;&lt;BR /&gt;data have_cohort1 /view=have_cohort1;&lt;BR /&gt;set have;&lt;BR /&gt;where cohort_flag=1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Then use the view in the macro call instead.</description>
      <pubDate>Fri, 10 May 2024 17:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927903#M365110</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-05-10T17:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to call TableN macro for Table 1, either getting errors or no output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927967#M365123</link>
      <description>&lt;P&gt;Looks like the macro also doesn't accept a data step view as suggested by Reeza.&lt;/P&gt;
&lt;P&gt;Below fully working sample code that demonstrates how you can prepare the data.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines dsd dlm=',' truncover;
  input DEM_AGE DEM_SEX cohort_flag TM_group;
  datalines;
3,1,1,0
2,1,1,1
3,2,1,1
3,2,1,1
3,2,1,0
2,2,1,1
2,1,1,1
3,1,1,1
2,1,1,1
3,2,1,0
2,1,1,0
2,2,1,1
3,2,1,0
2,2,0,
3,2,1,1
3,2,1,1
3,1,1,0
3,2,1,0
2,1,1,0
3,1,1,1
3,2,1,1
3,2,1,0
3,2,1,1
3,2,1,1
3,2,1,1
;
RUN;

proc format library=temp;
  value age2grp
    1='1:Age Group &amp;lt;65'
    2='2:Age Group [65,75)'
    3='3:Age Group &amp;gt;=75'
    .='Inapplicable/Missing'
  ;
  value sex
    1='1:Male'
    2='2:Female'
    .='Inapplicable/Missing'
  ;
  value yesfmt
    1='1:Yes'
    2='2:No'
    .='Inapplicable/Missing'
  ;
RUN;

filename tableN url 'https://communities.sas.com/kntur85557/attachments/kntur85557/library/4477/5/tablen_05102022.sas';
/*filename tableN url 'https://communities.sas.com/kntur85557/attachments/kntur85557/library/4477/5/tablen_032020_pharmasug.sas';*/
/*filename tableN url 'https://gist.githubusercontent.com/statgeek/b55d964c99975c2ba23fa771afe616bc/raw/b30d55caf6ec4028f5afed3b260ce86b50419ddb/tablen.sas';*/
%include tableN /source2;

data cohort_1;
  set have;
  where cohort_flag=1;
run;

%tablen(
  data=cohort_1
  ,by=TM_group
  ,var=DEM_AGE DEM_SEX
  ,type=2 2
  ,outdoc=C:\temp\test.rtf
  );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sat, 11 May 2024 02:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-call-TableN-macro-for-Table-1-either-getting-errors-or/m-p/927967#M365123</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-11T02:51:06Z</dc:date>
    </item>
  </channel>
</rss>

