<?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: Macro within a Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520181#M141019</link>
    <description>Should your macro calls be &amp;amp;cohb or &amp;amp;coh2? &lt;BR /&gt;It seems like you may be mixing counters?</description>
    <pubDate>Mon, 10 Dec 2018 22:09:11 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-12-10T22:09:11Z</dc:date>
    <item>
      <title>Macro within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520150#M141000</link>
      <description>&lt;P&gt;I need to read in the number of treatment groups and the unique count associated with each treatment in a macro. This unique number of cohort will be my denominator at a later step to create an adverse event table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc sort data=adae out=adae_subs (keep=subject cohort) nodupkey; by subject; run;&lt;BR /&gt;proc freq data=adae_subs nlevels noprint;&lt;BR /&gt;tables cohort/out=cohortct outcum;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data cohortct;&lt;BR /&gt;set cohortct;&lt;BR /&gt;rename count=cohortct;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select distinct cohort&lt;BR /&gt;into :coh1 - :coh3&lt;BR /&gt;from cohortct;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro coh(coh=,num=);&lt;BR /&gt;data test; &lt;BR /&gt;set cohortct;&lt;BR /&gt;where cohort="&amp;amp;coh.";&lt;BR /&gt;call symputx ("cohortct&amp;amp;num.",COHORTCT);&lt;BR /&gt;run;&lt;BR /&gt;%mend coh;&lt;BR /&gt;%coh (coh=&amp;amp;coh1,num=a);%coh (coh=&amp;amp;cohb,num=b);%coh (coh=&amp;amp;cohc,num=c);&lt;BR /&gt;%put &amp;amp;cohortcta;%put &amp;amp;cohortctb;%put &amp;amp;cohortctc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get the following warning&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference COHORTCTB not resolved.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 21:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520150#M141000</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2018-12-10T21:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520153#M141003</link>
      <description>&lt;P&gt;Post the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the macro call&amp;nbsp;%coh (coh=&amp;amp;cohb,num=b) resulting in any records in the dataset test ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 21:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520153#M141003</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-10T21:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Macro within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520175#M141014</link>
      <description>&lt;P&gt;Macro variable scope. Look at the third aprameter in CALL SYMPUTX() and use it to define your macro variables as global macro variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also want to look into CALL EXECUTE.&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/1717"&gt;@saslove&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need to read in the number of treatment groups and the unique count associated with each treatment in a macro. This unique number of cohort will be my denominator at a later step to create an adverse event table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc sort data=adae out=adae_subs (keep=subject cohort) nodupkey; by subject; run;&lt;BR /&gt;proc freq data=adae_subs nlevels noprint;&lt;BR /&gt;tables cohort/out=cohortct outcum;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data cohortct;&lt;BR /&gt;set cohortct;&lt;BR /&gt;rename count=cohortct;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select distinct cohort&lt;BR /&gt;into :coh1 - :coh3&lt;BR /&gt;from cohortct;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro coh(coh=,num=);&lt;BR /&gt;data test; &lt;BR /&gt;set cohortct;&lt;BR /&gt;where cohort="&amp;amp;coh.";&lt;BR /&gt;call symputx ("cohortct&amp;amp;num.",COHORTCT);&lt;BR /&gt;run;&lt;BR /&gt;%mend coh;&lt;BR /&gt;%coh (coh=&amp;amp;coh1,num=a);%coh (coh=&amp;amp;cohb,num=b);%coh (coh=&amp;amp;cohc,num=c);&lt;BR /&gt;%put &amp;amp;cohortcta;%put &amp;amp;cohortctb;%put &amp;amp;cohortctc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get the following warning&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference COHORTCTB not resolved.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 22:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520175#M141014</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-10T22:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520176#M141015</link>
      <description>&lt;P&gt;I guess you also get a WARNING for cohb, as that macro variable is never defined in your code; I think you wanted to use coh2 instead. Same with cohc, which should be coh3.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 22:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520176#M141015</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-10T22:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520181#M141019</link>
      <description>Should your macro calls be &amp;amp;cohb or &amp;amp;coh2? &lt;BR /&gt;It seems like you may be mixing counters?</description>
      <pubDate>Mon, 10 Dec 2018 22:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520181#M141019</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-10T22:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520212#M141033</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this statement call symputx ("cohortct&amp;amp;num.",COHORTCT);&lt;/P&gt;&lt;P&gt;COHORTCT is a variable that does not exist in your proc freq output dataset named COHORTCT&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;PRE&gt;&lt;CODE class=" language-sas"&gt;
data adae_subs ;
set sashelp.class(rename=(weight=cohort));
run;


proc freq data=adae_subs nlevels noprint;
tables cohort/out=cohortct(rename=(count=cohortct)) outcum;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Dec 2018 00:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-within-a-Macro/m-p/520212#M141033</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2018-12-11T00:24:04Z</dc:date>
    </item>
  </channel>
</rss>

