<?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: Cannot get macros to work in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905505#M40449</link>
    <description>&lt;P&gt;I appreciate your patience. I'm a new SAS user and still trying to understand SAS. I don't need macros to do what I want, but I want to eliminate human error by having to copy-paste numbers. Please let me know if I should just not use macros.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my dataset:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nfatahi_0-1701401492478.png" style="width: 580px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90527i5B9476A9998039F5/image-dimensions/580x189?v=v2" width="580" height="189" role="button" title="nfatahi_0-1701401492478.png" alt="nfatahi_0-1701401492478.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to do t-tests, comparing the mean(mnpv) for United States with all of the other countries. I want my output to be a table with the country name, the mean, the standard error(mnpv_se), and the result of the t-test (the calculated t value and a label that tells me if the mean is higher or lower than the USA).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can just copy and paste the mean for the United States but I'm doing this close to a hundred times to it will be lots of copy pasting. So I was hoping I can just tell SAS to use the USA mean as the 'base mean'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all the help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Dec 2023 03:37:17 GMT</pubDate>
    <dc:creator>nfatahi</dc:creator>
    <dc:date>2023-12-01T03:37:17Z</dc:date>
    <item>
      <title>Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905298#M40435</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to write a macro that will pick a base mean and compare all the other means in my dataset to that mean (by doing a t-test). I also want to compare all the means to the international mean. I want my ouput to be a table that has the country ID (IDCNTRY), the mean (mnpv), the standard error (mnpv_se), the t value, and the label for 'H' or 'L' to indicate if the means are significantly higher or lower.&amp;nbsp; Here is what I have but I keep getting errors:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/SPAN&gt; T(YEAR=, FILE=, base=, scale_name=, TABLE=);&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;%put&lt;/SPAN&gt; TABLE: &amp;amp;TABLE.;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;ODS SELECT NONE;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;proc sql;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;select mnpv, mnpv_se into :mean_base, :mean_se_base&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;from &lt;SPAN class=""&gt;OUTDIR.&lt;/SPAN&gt;&amp;amp;FILE._&amp;amp;&lt;SPAN class=""&gt;TABLE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;where IDCNTRY=&lt;SPAN class=""&gt;"&amp;amp;base"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;quit;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;proc sql;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;CREATE TABLE &amp;amp;&lt;SPAN class=""&gt;scale_name.&lt;/SPAN&gt; AS&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;SELECT&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;IDCNTRY,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;mnpv AS &amp;amp;scale_name._Mean,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;mnpv_se AS &amp;amp;scale_name._SE,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;mnpv_se * mnpv_se AS &amp;amp;scale_name._SE_Square,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;/* international average */&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;(mnpv - &lt;SPAN class=""&gt;&lt;STRONG&gt;496&lt;/STRONG&gt;&lt;/SPAN&gt;) / mnpv_se AS &amp;amp;scale_name._t_500,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;((mnpv - &lt;SPAN class=""&gt;&lt;STRONG&gt;496&lt;/STRONG&gt;&lt;/SPAN&gt;) / mnpv_se ) / &lt;SPAN class=""&gt;&lt;STRONG&gt;1.96&lt;/STRONG&gt;&lt;/SPAN&gt; AS &amp;amp;scale_name._t_cv_500,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;CASE WHEN calculated &amp;amp;scale_name._t_cv_500 &amp;gt;= &lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; THEN &lt;SPAN class=""&gt;' H'&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;WHEN -&lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &amp;lt; calculated &amp;amp;scale_name._t_cv_500 &amp;lt; &lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; THEN &lt;SPAN class=""&gt;' '&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;WHEN calculated &amp;amp;scale_name._t_cv_500 &amp;lt;= -&lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; THEN &lt;SPAN class=""&gt;' L'&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;END AS &amp;amp;scale_name._sig_500,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;/* comparing to base group */&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;(mnpv - &amp;amp;&lt;SPAN class=""&gt;mean_base.&lt;/SPAN&gt;) / sqrt(mnpv_se**&lt;SPAN class=""&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt; + &amp;amp;&lt;SPAN class=""&gt;mean_se_base.&lt;/SPAN&gt;**&lt;SPAN class=""&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;) AS &amp;amp;scale_name._t_base,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;((mnpv - &amp;amp;&lt;SPAN class=""&gt;mean_base.&lt;/SPAN&gt;) / sqrt(mnpv_se**&lt;SPAN class=""&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt; + &amp;amp;&lt;SPAN class=""&gt;mean_se_base.&lt;/SPAN&gt;**&lt;SPAN class=""&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;)) / &lt;SPAN class=""&gt;&lt;STRONG&gt;1.96&lt;/STRONG&gt;&lt;/SPAN&gt; AS &amp;amp;scale_name._t_cv_base,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;CASE WHEN calculated &amp;amp;scale_name._t_cv_base &amp;gt;= &lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; THEN &lt;SPAN class=""&gt;' H'&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;WHEN -&lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &amp;lt; calculated &amp;amp;scale_name._t_cv_base &amp;lt; &lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; THEN &lt;SPAN class=""&gt;' '&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;WHEN calculated &amp;amp;scale_name._t_cv_base &amp;lt;= -&lt;SPAN class=""&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; THEN &lt;SPAN class=""&gt;' L'&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;END AS &amp;amp;scale_name._sig_base&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;FROM &lt;SPAN class=""&gt;OUTDIR.&lt;/SPAN&gt;&amp;amp;FILE._&amp;amp;&lt;SPAN class=""&gt;TABLE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;ORDER BY IDCNTRY;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;QUIT; &lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;proc sql;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;CREATE TABLE &amp;amp;scale_name._2 AS&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;SELECT *&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;FROM &amp;amp;&lt;SPAN class=""&gt;scale_name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;ORDER BY IDCNTRY, &amp;amp;scale_name._Mean DESC;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;QUIT;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;ods select all;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;PROC PRINT DATA=&amp;amp;&lt;SPAN class=""&gt;scale_name.&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;TITLE &lt;/SPAN&gt;"&amp;amp;TABLE.: &amp;amp;scale_name."&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;FORMAT _NUMERIC_ &lt;SPAN class=""&gt;&lt;STRONG&gt;20.5&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;RUN;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;SPAN class=""&gt; T;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;/*----------------------------------------------------------*/&lt;/P&gt;&lt;P class=""&gt;/* Table 1. &lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;*/&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;%&lt;STRONG&gt;&lt;I&gt;T&lt;/I&gt;&lt;/STRONG&gt;(YEAR=&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;2018&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;FILE=D2018,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;base=USA&lt;/P&gt;&lt;P class=""&gt;scale_name= CIL&lt;/P&gt;&lt;P class=""&gt;TABLE= TABLE1);&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;What am I missing??&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 02:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905298#M40435</guid>
      <dc:creator>nfatahi</dc:creator>
      <dc:date>2023-11-30T02:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905299#M40436</link>
      <description>&lt;P&gt;There's an obvious problem with how you are calling the macro - you are missing commas between parameters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%T(YEAR=2018,
FILE=D2018,
base=USA&lt;STRONG&gt;,&lt;/STRONG&gt;
scale_name= CIL&lt;STRONG&gt;,&lt;/STRONG&gt;
TABLE= TABLE1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Nov 2023 03:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905299#M40436</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-11-30T03:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905302#M40437</link>
      <description>&lt;P&gt;Hiding continuation characters, like the commas in your macro call, at the END of the line makes much more difficult for a human to scan the code and confirm it meets the required pattern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%T(YEAR=2018
 ,FILE=D2018
 ,base=USA
 ,scale_name= CIL
 ,TABLE= TABLE1
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Turn on the MPRINT option before the macro call to see what SAS code the macro call ends up generating.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 03:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905302#M40437</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-30T03:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905502#M40447</link>
      <description>&lt;P&gt;Thank you for this suggestion. It seems that there might be a problem with these expressions:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;mean_base.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;mean_se_base.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think I'm defining these correctly. I want the mean_base to be the mean math score for USA. I have a mean math score variable (mnpv) and a country variable (IDCNTRY).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 02:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905502#M40447</guid>
      <dc:creator>nfatahi</dc:creator>
      <dc:date>2023-12-01T02:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905503#M40448</link>
      <description>&lt;P&gt;So the issue is not in RUNNING the macro?&lt;/P&gt;
&lt;P&gt;It sounds like instead the issue is in getting the macro to generate code that does what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case you need to describe what you WANT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide example input data and the desired output for that input?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you describe (in words) what you are trying to calculate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure you need a macro?&amp;nbsp; Can you get what you want by just writing SAS code instead of writing a macro to generate SAS code?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 03:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905503#M40448</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-01T03:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905505#M40449</link>
      <description>&lt;P&gt;I appreciate your patience. I'm a new SAS user and still trying to understand SAS. I don't need macros to do what I want, but I want to eliminate human error by having to copy-paste numbers. Please let me know if I should just not use macros.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my dataset:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nfatahi_0-1701401492478.png" style="width: 580px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90527i5B9476A9998039F5/image-dimensions/580x189?v=v2" width="580" height="189" role="button" title="nfatahi_0-1701401492478.png" alt="nfatahi_0-1701401492478.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to do t-tests, comparing the mean(mnpv) for United States with all of the other countries. I want my output to be a table with the country name, the mean, the standard error(mnpv_se), and the result of the t-test (the calculated t value and a label that tells me if the mean is higher or lower than the USA).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can just copy and paste the mean for the United States but I'm doing this close to a hundred times to it will be lots of copy pasting. So I was hoping I can just tell SAS to use the USA mean as the 'base mean'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all the help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 03:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905505#M40449</guid>
      <dc:creator>nfatahi</dc:creator>
      <dc:date>2023-12-01T03:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905509#M40450</link>
      <description>&lt;P&gt;Don't try to stuff DATA into macro variables.&amp;nbsp; Leave it in datasets.&lt;/P&gt;
&lt;P&gt;Looks like you want to make two new numerical VARIABLES (not macro language symbols with text strings in them).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dsname=OUTDIR.&amp;amp;FILE._&amp;amp;TABLE.;
data base ;
  set &amp;amp;dsname;
  where IDCNTRY="&amp;amp;base";
  keep mnpv mnpv_se;
  rename mnpv=mean_base mnpv_se=mean_se_base;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which you can then remerge with your other data and make your new variables.&lt;/P&gt;
&lt;P&gt;So something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;amp;scale_name. ;
  set &amp;amp;dsname (keep=IDCNTRY mnpv mnpv_se);
  if _n_=1 then set base;
  rename mnpv =  &amp;amp;scale_name._Mean mnpv_se = &amp;amp;scale_name._SE ;

  &amp;amp;scale_name._SE_Square = mnpv_se * mnpv_se;
  &amp;amp;scale_name._t_500 = (mnpv - 496) / mnpv_se ;
  &amp;amp;scale_name._t_cv_500 = ((mnpv - 496) / mnpv_se ) / 1.96 ;
  if &amp;amp;scale_name._t_cv_500 &amp;gt;= 1 THEN &amp;amp;scale_name._sig_500=' H';
  else if -1 &amp;lt; &amp;amp;scale_name._t_cv_500 &amp;lt; 1 THEN &amp;amp;scale_name._sig_500=' ';
  else if .z &amp;lt; scale_name._t_cv_500 &amp;lt;= -1 THEN &amp;amp;scale_name._sig_500=' L';

  &amp;amp;scale_name._t_base = (mnpv - mean_base) / sqrt(mnpv_se**2 + mean_se_base**2);
  &amp;amp;scale_name._t_cv_base = ((mnpv - mean_base) / sqrt(mnpv_se**2 + mean_se_base**2)) / 1.96 ;
  if &amp;amp;scale_name._t_cv_base &amp;gt;= 1 THEN &amp;amp;scale_name._sig_base=' H';
  else if -1 &amp;lt; &amp;amp;scale_name._t_cv_base &amp;lt; 1 THEN &amp;amp;scale_name._sig_base=' ';
  else if .z &amp;lt; &amp;amp;scale_name._t_cv_base &amp;lt;= -1 THEN &amp;amp;scale_name._sig_base=' L';
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Dec 2023 03:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905509#M40450</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-01T03:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get macros to work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905516#M40453</link>
      <description>&lt;P&gt;So you have a STATISTICs question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are using SAS, not FORTRAN or SQL.&amp;nbsp; You probably can do it easily enough with a simple statistical procedure.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You appear to have already summarized the data to the country level.&amp;nbsp; I see something that looks like a COUNT in addition to the MEAN and other statistics that are as clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have the actual raw data also?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 04:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Cannot-get-macros-to-work/m-p/905516#M40453</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-01T04:17:00Z</dc:date>
    </item>
  </channel>
</rss>

