<?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: add a column which refers to a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473305#M121441</link>
    <description>&lt;P&gt;There's a conflict here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beginning SAS student&lt;/P&gt;
&lt;P&gt;refers to a macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a beginner, you should NOT think about macro programming AT ALL. Since all SAS issues can be solved without the use of a macro (albeit inefficiently in some cases), you absolutely need to learn to solve those issues with Base SAS language alone. Only when you have a sufficiently advanced grasp of what can and should be done with Base SAS and the data step, you can start &lt;EM&gt;optimizing&lt;/EM&gt; your code by using macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro preprocessor is not a problem solver, but a helper in making &lt;EM&gt;code writing&lt;/EM&gt; more efficient.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jun 2018 11:03:04 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-06-26T11:03:04Z</dc:date>
    <item>
      <title>add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473279#M121428</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Beginning SAS student here. I created a table with 49 rows, columns are 2 means and 2 stds. I need to add a column which refers to a macro that calculates CohensD based on the rows of data. I can't for the life of me figure it out!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 09:05:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473279#M121428</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2018-06-26T09:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro [how to improve your question]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473281#M121430</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217720"&gt;@axescot78&lt;/a&gt;,&lt;/P&gt;&lt;BR /&gt; &lt;P&gt;Your question requires more details before experts can help.&amp;nbsp;Can you revise your question to include more information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Review this checklist:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Specify a meaningful subject line for your topic.&amp;nbsp; Avoid generic subjects like "need help," "SAS query," or "urgent."&lt;/LI&gt;
&lt;LI&gt;When appropriate, provide sample data in text or DATA step format.&amp;nbsp; See &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;this article for one method&lt;/A&gt;&amp;nbsp;you can use.&lt;/LI&gt;
&lt;LI&gt;If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition.&amp;nbsp;Use the&amp;nbsp;&lt;STRONG&gt;Photos&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;button to include the image in your message.&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 279px;"&gt;&lt;IMG src="https://kntur85557.i.lithium.com/t5/image/serverpage/image-id/16608i91A52F817EAC9A69/image-dimensions/279x150?v=1.0" width="279" height="150" alt="use_buttons.png" title="use_buttons.png" /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;It also helps to include an example (table or picture) of the result that you're trying to achieve.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To edit your original message, select the "blue gear" icon at the top of the message and select&amp;nbsp;&lt;STRONG&gt;Edit Message&lt;/STRONG&gt;.&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;From there you can adjust the title and add more details to the body of the message.&amp;nbsp; Or, simply reply to this message with any additional information you can supply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 229px;"&gt;&lt;IMG src="https://kntur85557.i.lithium.com/t5/image/serverpage/image-id/16605iAC020BC79315B045/image-size/large?v=1.0&amp;amp;px=600" alt="edit_post.png" title="edit_post.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;SAS experts are eager to help -- help&amp;nbsp;&lt;EM&gt;them&lt;/EM&gt; by providing as much detail as you can.&lt;/P&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style:italic;font-size:smaller;"&gt;This prewritten response was triggered for you by fellow SAS Support Communities member &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;.</description>
      <pubDate>Tue, 26 Jun 2018 09:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473281#M121430</guid>
      <dc:creator>Community_Guide</dc:creator>
      <dc:date>2018-06-26T09:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473283#M121432</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;I need to add a column which refers to a macro that calculates CohensD based on the rows of data." - first things first.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Base SAS - this is the programming language.&amp;nbsp; It is fully functional with all data types and can do anything you want.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Macro - this is a sub-component designed for creating text, which can be code.&amp;nbsp; It is not used as a replacement for Base SAS.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Now from this, how does a column of values relate to a macro?&amp;nbsp; They don't, data in datasets is controlled and manipulated by Base SAS.&amp;nbsp; So there is your starting point, writing Base SAS to do the process.&amp;nbsp; Once you have that fully down, then you can look at methods to generalise code and such like using macro once you fully grasp what is being generated.&amp;nbsp; Don't run before you can walk and all that.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As for specifics, post code, example test data in the form of a datastep, show what the output should look like, any information at all that helps us, who cannot see your computer, to see the problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 09:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473283#M121432</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-26T09:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473297#M121436</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 333px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21389iBAE3E430A278B2CA/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;This is the first 8 rows of the table that I created. I need to add another column that calculates CohensD, which takes values from&amp;nbsp; this table: (absolute value of mean1 - mean2) divided by sqrt((SD1^2+SD2^2)/2). The calculation needs to be done in a macro and the table columns are the macro's parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below. The parts in bold are where I am stuck. It's throwing an error: ERROR: Undeclared array referenced: CookingTooMuch. Also, is there special notation to pass an array into a macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%macro CohensD(m_1,m_2,s_1,s_2);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; %let x = (abs(&amp;amp;m_1-&amp;amp;m_2))/(sqrt((&amp;amp;s_1**2 + &amp;amp;s_2**2)/2)));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;amp;x;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;%mend CohensD;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;proc iml;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Year = {1936, 1946, 1951, 1963, 1975, 1997, 2006};&lt;BR /&gt;x = nrow(Year);&lt;BR /&gt;&lt;BR /&gt;Year1 = repeat(Year,x,1);&lt;BR /&gt;Year2 = repeat(Year[1],x,1) // repeat(Year[2],x,1) // repeat(Year[3],x,1) // repeat(Year[4],x,1) // repeat(Year[5],x,1) // repeat(Year[6],x,1) // repeat(Year[7],x,1);&lt;BR /&gt;&lt;BR /&gt;CaloriesPerRecipeMean = {2123.8, 2122.3, 2089.9, 2250.0, 2234.2, 2249.6, 3051.9};&lt;BR /&gt;Mean1 = repeat(CaloriesPerRecipeMean,x,1);&lt;BR /&gt;Mean2 = repeat(CaloriesPerRecipeMean[1],x,1) // repeat(CaloriesPerRecipeMean[2],x,1) // repeat(CaloriesPerRecipeMean[3],x,1) // repeat(CaloriesPerRecipeMean[4],x,1) // repeat(CaloriesPerRecipeMean[5],x,1) // repeat(CaloriesPerRecipeMean[6],x,1) // repeat(CaloriesPerRecipeMean[7],x,1);&lt;BR /&gt;&lt;BR /&gt;CaloriesPerRecipeSD = {1050.0, 1002.3, 1009.6, 1078.6, 1089.2, 1094.8, 1496.2};&lt;BR /&gt;SD1 = repeat(CaloriesPerRecipeSD,x,1);&lt;BR /&gt;SD2 = repeat(CaloriesPerRecipeSD[1],x,1) // repeat(CaloriesPerRecipeSD[2],x,1) // repeat(CaloriesPerRecipeSD[3],x,1) // repeat(CaloriesPerRecipeSD[4],x,1) // repeat(CaloriesPerRecipeSD[5],x,1) // repeat(CaloriesPerRecipeSD[6],x,1) // repeat(CaloriesPerRecipeSD[7],x,1);&lt;BR /&gt;&lt;BR /&gt;create CookingTooMuch var {Year1, Year2, Mean1, Mean2, SD1, SD2};&lt;BR /&gt;append;&lt;BR /&gt;close CookingTooMuch;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;BR /&gt;proc print data=CookingTooMuch;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;data CookingTooMuch2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; set CookingTooMuch;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; CohensD=%CohensD(CookingTooMuch[M1],CookingTooMuch[M2],CookingTooMuch[S1],CookingTooMuch[S2]);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;proc print data=CookingTooMuch2;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 10:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473297#M121436</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2018-06-26T10:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473299#M121437</link>
      <description>&lt;P&gt;See, you have gone and fallen for the old chestnut again:&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;The calculation needs to be done in a macro and the table columns are the macro's parameters."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Start by writing Base SAS - it is the programming language:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data CookingTooMuch2;&lt;BR /&gt; set CookingTooMuch;&lt;BR /&gt; CohensD=(abs(mean1-mean2))/(sqrt((sd1**2 + sd2**2)/2)));&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;There is no reason for macro anywhere in this code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As for your provided information:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;&amp;nbsp; CohensD=%CohensD(CookingTooMuch[M1],CookingTooMuch[M2],CookingTooMuch[S1],CookingTooMuch[S2]);&lt;/PRE&gt;
&lt;P&gt;What is CookingTooMuch[M1] supposed to mean?&amp;nbsp; It almost appears you want to refer to an array, but have not created any?&lt;/P&gt;
&lt;P&gt;It should perhaps read:&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;&amp;nbsp; CohensD=%CohensD(mean1,mean2,sd1,sd2);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 10:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473299#M121437</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-26T10:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473301#M121438</link>
      <description>&lt;P&gt;Despite not being an IML user (so I'm assuming your formula and use in context are correct), this looks like the right way to go:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%macro CohensD(m_1,m_2,s_1,s_2);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; (abs(&amp;amp;m_1-&amp;amp;m_2))/(sqrt((&amp;amp;s_1**2 + &amp;amp;s_2**2)/2)))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;%mend CohensD;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The semicolon can be removed at the end of the formula, because you have one in the program after calling the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you test it, add this first to make debugging easier:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options mprint;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 10:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473301#M121438</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-26T10:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473305#M121441</link>
      <description>&lt;P&gt;There's a conflict here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beginning SAS student&lt;/P&gt;
&lt;P&gt;refers to a macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a beginner, you should NOT think about macro programming AT ALL. Since all SAS issues can be solved without the use of a macro (albeit inefficiently in some cases), you absolutely need to learn to solve those issues with Base SAS language alone. Only when you have a sufficiently advanced grasp of what can and should be done with Base SAS and the data step, you can start &lt;EM&gt;optimizing&lt;/EM&gt; your code by using macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro preprocessor is not a problem solver, but a helper in making &lt;EM&gt;code writing&lt;/EM&gt; more efficient.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473305#M121441</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-26T11:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473307#M121442</link>
      <description>&lt;P&gt;I figured this out. If anyone is interested, here is the correct code and output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 389px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21390iC57A508E0EE3A838/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;%macro CohensD(m_1,m_2,s_1,s_2);&lt;BR /&gt;&amp;nbsp; %let x = (abs(&amp;amp;m_1-&amp;amp;m_2))/(sqrt((&amp;amp;s_1**2 + &amp;amp;s_2**2)/2));&lt;BR /&gt;&amp;nbsp; &amp;amp;x;&lt;BR /&gt;%mend CohensD;&lt;BR /&gt;&lt;BR /&gt;proc iml;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Year = {1936, 1946, 1951, 1963, 1975, 1997, 2006};&lt;BR /&gt;x = nrow(Year);&lt;BR /&gt;&lt;BR /&gt;Year1 = repeat(Year,x,1);&lt;BR /&gt;Year2 = repeat(Year[1],x,1) // repeat(Year[2],x,1) // repeat(Year[3],x,1) // repeat(Year[4],x,1) // repeat(Year[5],x,1) // repeat(Year[6],x,1) // repeat(Year[7],x,1);&lt;BR /&gt;&lt;BR /&gt;CaloriesPerRecipeMean = {2123.8, 2122.3, 2089.9, 2250.0, 2234.2, 2249.6, 3051.9};&lt;BR /&gt;Mean1 = repeat(CaloriesPerRecipeMean,x,1);&lt;BR /&gt;Mean2 = repeat(CaloriesPerRecipeMean[1],x,1) // repeat(CaloriesPerRecipeMean[2],x,1) // repeat(CaloriesPerRecipeMean[3],x,1) // repeat(CaloriesPerRecipeMean[4],x,1) // repeat(CaloriesPerRecipeMean[5],x,1) // repeat(CaloriesPerRecipeMean[6],x,1) // repeat(CaloriesPerRecipeMean[7],x,1);&lt;BR /&gt;&lt;BR /&gt;CaloriesPerRecipeSD = {1050.0, 1002.3, 1009.6, 1078.6, 1089.2, 1094.8, 1496.2};&lt;BR /&gt;SD1 = repeat(CaloriesPerRecipeSD,x,1);&lt;BR /&gt;SD2 = repeat(CaloriesPerRecipeSD[1],x,1) // repeat(CaloriesPerRecipeSD[2],x,1) // repeat(CaloriesPerRecipeSD[3],x,1) // repeat(CaloriesPerRecipeSD[4],x,1) // repeat(CaloriesPerRecipeSD[5],x,1) // repeat(CaloriesPerRecipeSD[6],x,1) // repeat(CaloriesPerRecipeSD[7],x,1);&lt;BR /&gt;&lt;BR /&gt;create CookingTooMuch var {Year1, Year2, Mean1, Mean2, SD1, SD2};&lt;BR /&gt;append;&lt;BR /&gt;close CookingTooMuch;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;BR /&gt;proc print data=CookingTooMuch;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data CookingTooMuch2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set CookingTooMuch;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; CohensD=%CohensD(Mean1,Mean2,SD1,SD2);&lt;BR /&gt;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;proc print data=CookingTooMuch2;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473307#M121442</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2018-06-26T11:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473316#M121446</link>
      <description>&lt;P&gt;Maybe I'm a Super User and didn't even know it! hahahahahaha&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 11:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473316#M121446</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2018-06-26T11:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473337#M121452</link>
      <description>&lt;P&gt;There's still no reason to use a macro at all. It just moves code away from where it is used, and makes your whole code less readable and less maintainable, for no apparent gain. Remove the macro defintion and put the code where it belongs in the last data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data CookingTooMuch2;
   set CookingTooMuch;
   CohensD=(abs(Mean1-Mean2))/(sqrt((SD1**2 + SD2**2)/2));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jun 2018 12:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473337#M121452</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-26T12:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473481#M121511</link>
      <description>I'm doing this for a class and part of the requirements is to use a macro &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Tue, 26 Jun 2018 17:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473481#M121511</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2018-06-26T17:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473483#M121513</link>
      <description>Actually, if you have a more elegant solution to how to get the 2nd, 4th, and 6th columns to repeat like that, I'm all ears!</description>
      <pubDate>Tue, 26 Jun 2018 17:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473483#M121513</guid>
      <dc:creator>axescot78</dc:creator>
      <dc:date>2018-06-26T17:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473488#M121516</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217720"&gt;@axescot78&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Actually, if you have a more elegant solution to how to get the 2nd, 4th, and 6th columns to repeat like that, I'm all ears!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Repeating code is a valid argument for a macro, in which case I have a suggestion to make your macro simpler:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro CohensD(m_1,m_2,s_1,s_2);
abs(&amp;amp;m_1-&amp;amp;m_2))/(sqrt((&amp;amp;s_1**2 + &amp;amp;s_2**2)/2);
%mend CohensD;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;although the gain here (in terms of code that needs typing) is still very limited.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 17:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473488#M121516</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-26T17:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: add a column which refers to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473612#M121557</link>
      <description>&lt;P&gt;And when you need to repeat a formula over several columns, consider to use arrays and a do loop.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 06:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-a-column-which-refers-to-a-macro/m-p/473612#M121557</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-27T06:37:37Z</dc:date>
    </item>
  </channel>
</rss>

