<?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: use macro variable in model statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294114#M61330</link>
    <description>Dear overmar,&lt;BR /&gt;Thank you very much! Sorry I didn't response you earlier, the first one I what I wanted. But it is also good to know how to code the second scenario, cause I may need it in future.&lt;BR /&gt;This is fantastic!&lt;BR /&gt;Thanks again!&lt;BR /&gt;Best wishes.</description>
    <pubDate>Thu, 25 Aug 2016 17:55:26 GMT</pubDate>
    <dc:creator>Xiaoningdemao</dc:creator>
    <dc:date>2016-08-25T17:55:26Z</dc:date>
    <item>
      <title>use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293884#M61252</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple question here, I have two list of variables:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; A= A1 A2 A3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; B= B1 B2 B3;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I want to fit a PH regression model with effect of A's and B's and their interaction repectively, i.e. :A1*B1 A2*B2 A3*B3.&lt;/P&gt;&lt;P&gt;I ceded as follow, but this doesn't give me the interaction term i desired, it only gives me A3*B1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;phreg&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=modeldata;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;model&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; followup*pass(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;) = &amp;amp;A &amp;amp;B aA*&amp;amp;B ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help address this bug?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank youvery much!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best wishes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 22:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293884#M61252</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-08-24T22:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293886#M61254</link>
      <description>&lt;P&gt;Besides missing an &amp;amp; in A*&amp;amp;B what did you want to create? Since there are many possible variations of possible syntax involving () around individual or groups of variables and the * it helps to know what the desired result for your model statement would be if &lt;STRONG&gt;no&lt;/STRONG&gt; macro variables at all were involved.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 22:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293886#M61254</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-24T22:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293887#M61255</link>
      <description>&lt;P&gt;You can specify interaction terms by including&amp;nbsp;@2 after your variables to get all 2 way interactions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Model x = a b&amp;nbsp;@2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glm_sect027.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glm_sect027.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 22:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293887#M61255</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-24T22:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293894#M61260</link>
      <description>Dear Reeza,&lt;BR /&gt;Thank you for the quick response!&lt;BR /&gt;&lt;BR /&gt;I tried&lt;BR /&gt;a b @2; &amp;amp;a &amp;amp;b @2; &amp;amp;a| &amp;amp;b @2; .....&lt;BR /&gt;But I still only got the interaction of A1*B3..... Is this only effect on non-macro variables?&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;&lt;BR /&gt;Best wishes.</description>
      <pubDate>Wed, 24 Aug 2016 23:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293894#M61260</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-08-24T23:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293904#M61267</link>
      <description>&lt;P&gt;No, maybe you need the bar between them. What does the documentation say? I'd have to reference it to verify anyways.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you add bars between variables in your macrovarisble?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 00:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/293904#M61267</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-25T00:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294073#M61327</link>
      <description>&lt;P&gt;Before you attempt a macro solution you should have a &lt;STRONG&gt;working&lt;/STRONG&gt; base case without macro variables.&lt;/P&gt;
&lt;P&gt;Show the entire code of the procedure that was working before the introduction of macro variables.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 15:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294073#M61327</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-25T15:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294106#M61328</link>
      <description>&lt;P&gt;Which are you trying to get as an a running model?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 1) &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;phreg&lt;/STRONG&gt; data=modeldata;&lt;/P&gt;
&lt;P&gt;model followup*pass(&lt;STRONG&gt;0&lt;/STRONG&gt;) = A1 A2 A3 B1 B2 B3 A1*B1 A2*B2 A3*B3 ;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 2)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;phreg&lt;/STRONG&gt; data=modeldata;&lt;/P&gt;
&lt;P&gt;model followup*pass(&lt;STRONG&gt;0&lt;/STRONG&gt;) = A1 B1 A1*B1;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;phreg&lt;/STRONG&gt; data=modeldata;&lt;/P&gt;
&lt;P&gt;model followup*pass(&lt;STRONG&gt;0&lt;/STRONG&gt;) = A2 B2 A2*B2;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;phreg&lt;/STRONG&gt; data=modeldata;&lt;/P&gt;
&lt;P&gt;model followup*pass(&lt;STRONG&gt;0&lt;/STRONG&gt;) = A3 B3 A3*B3;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because the way to do them is very different.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 17:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294106#M61328</guid>
      <dc:creator>overmar</dc:creator>
      <dc:date>2016-08-25T17:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294110#M61329</link>
      <description>&lt;P&gt;This is essentially how you could do it, wanted1 is solution 1, and wanted2 is solution 2. Hope this makes sense.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro wanted1;&lt;BR /&gt;%let A= A1 A2 A3;&lt;BR /&gt;%let B= B1 B2 B3;&lt;BR /&gt;&lt;BR /&gt;proc phreg data=_null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;model followup*pass(0) = &lt;BR /&gt;%do i = 1 %to 3;&lt;BR /&gt;%let wanta = %scan(&amp;amp;a,&amp;amp;i,' ');&lt;BR /&gt;%let wantb = %scan(&amp;amp;b,&amp;amp;i,' ');&lt;BR /&gt;&amp;amp;wanta &amp;amp;wantb &amp;amp;wanta*&amp;amp;wantb&lt;BR /&gt;%end;&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;BR /&gt;%wanted1;&lt;BR /&gt;&lt;BR /&gt;%macro wanted2;&lt;BR /&gt;%let A= A1 A2 A3;&lt;BR /&gt;%let B= B1 B2 B3;&lt;BR /&gt;%do i = 1 %to 3;&lt;BR /&gt;%let wanta = %scan(&amp;amp;a,&amp;amp;i,' ');&lt;BR /&gt;%let wantb = %scan(&amp;amp;b,&amp;amp;i,' ');&lt;BR /&gt;proc phreg data=modeldata;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;model followup*pass(0) = &amp;amp;wanta &amp;amp;wantb &amp;amp;wanta*&amp;amp;wantb;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%wanted2;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 17:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294110#M61329</guid>
      <dc:creator>overmar</dc:creator>
      <dc:date>2016-08-25T17:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294114#M61330</link>
      <description>Dear overmar,&lt;BR /&gt;Thank you very much! Sorry I didn't response you earlier, the first one I what I wanted. But it is also good to know how to code the second scenario, cause I may need it in future.&lt;BR /&gt;This is fantastic!&lt;BR /&gt;Thanks again!&lt;BR /&gt;Best wishes.</description>
      <pubDate>Thu, 25 Aug 2016 17:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294114#M61330</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-08-25T17:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294116#M61332</link>
      <description>Just for reference when I make lists such as your %let A = A1 A2 A3; I always intentionally put a character or something into the list that shouldn't be there, ie a '^', so I would say&lt;BR /&gt;%let A = A1^A2^A3;&lt;BR /&gt;then in the scan code the third parameter would be '^' rather than ' '. I do this because a space is a lot easier to accidentally code than a ^. But maybe its just me.</description>
      <pubDate>Thu, 25 Aug 2016 17:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294116#M61332</guid>
      <dc:creator>overmar</dc:creator>
      <dc:date>2016-08-25T17:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294119#M61333</link>
      <description>Dear Reeza,&lt;BR /&gt;Sorry I didn't get what you meant, I tried &amp;amp;a| &amp;amp;b @2; but is doesn't work. If I do it this way, there's no error message, just one note:&lt;BR /&gt;NOTE: '@n' notation is only valid with bar effects.&lt;BR /&gt;Thanks again!&lt;BR /&gt;Best wishes.</description>
      <pubDate>Thu, 25 Aug 2016 18:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294119#M61333</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-08-25T18:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable in model statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294121#M61334</link>
      <description>Dear overmar,&lt;BR /&gt;Haha, thank you for the note! I was wondering what the third parameter " " mean..... if I just use space between element, I can omit this ' ' right? Cause that is how I coded before.&lt;BR /&gt;Thanks.&lt;BR /&gt;Best wishes,&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Aug 2016 18:04:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-in-model-statement/m-p/294121#M61334</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-08-25T18:04:34Z</dc:date>
    </item>
  </channel>
</rss>

