<?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: PROC REPORT if a column variable is a statistic name in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/603984#M76490</link>
    <description>&lt;P&gt;First would be why are you creating variables with those names in first place.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second might be to share the sort of Proc Report you are creating. The issue with report is can the procedure tell that a keyword is only used as variable name or not. It is okay to have a variable named "mean" as long as you don't ask Proc Report to calculate a mean for anything.&lt;/P&gt;
&lt;P&gt;An example of using a variable named mean in Proc report. Note that if you do not explicitly include a DEFINE statement then SAS does not know that you intend the Mean that appears on the column statement to be a variable and will complain.&lt;/P&gt;
&lt;PRE&gt;data example;
  do i= 1 to 5;
   do j= 1 to 20;
     mean= rand('uniform');
     output;
   end;
  end;
run;

proc report data=example;
   column i mean,(min  max) ;
   define i/group;
   define mean / analysis;
run;&lt;/PRE&gt;
&lt;P&gt;As soon as you want the mean of another variable you can't use it on the column statement. But a specific define may get you around that:&lt;/P&gt;
&lt;PRE&gt;data example;
  do i= 1 to 5;
   do j= 1 to 20;
     mean= rand('uniform');
     y   = rand('uniform');
     output;
   end;
  end;
run;

proc report data=example;
   column i mean,(min  max) y;
   define i/group;
   define mean / analysis;
   define y /mean;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may just be easier in the long run&amp;nbsp;to quit naming variables with keywords.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2019 21:35:12 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-11-13T21:35:12Z</dc:date>
    <item>
      <title>PROC REPORT if a column variable is a statistic name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/603939#M76489</link>
      <description>&lt;P&gt;If my dataset variables are the names of statistics (e.g mean min max) , is there no built-in way to use those variables in proc report columns, At the moment I am renaming the variables so they are no longer statistic names. The only &lt;A href="http://www.biostat.umn.edu/~greg-g/condes.sas" target="_blank" rel="noopener"&gt;reference&lt;/A&gt; I've been able to find does the same ,renaming "mean" to "xmean", "std" to "xstd" etc, "so proc report does not get confused"&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 19:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/603939#M76489</guid>
      <dc:creator>JohnHoughton</dc:creator>
      <dc:date>2019-11-13T19:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT if a column variable is a statistic name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/603984#M76490</link>
      <description>&lt;P&gt;First would be why are you creating variables with those names in first place.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second might be to share the sort of Proc Report you are creating. The issue with report is can the procedure tell that a keyword is only used as variable name or not. It is okay to have a variable named "mean" as long as you don't ask Proc Report to calculate a mean for anything.&lt;/P&gt;
&lt;P&gt;An example of using a variable named mean in Proc report. Note that if you do not explicitly include a DEFINE statement then SAS does not know that you intend the Mean that appears on the column statement to be a variable and will complain.&lt;/P&gt;
&lt;PRE&gt;data example;
  do i= 1 to 5;
   do j= 1 to 20;
     mean= rand('uniform');
     output;
   end;
  end;
run;

proc report data=example;
   column i mean,(min  max) ;
   define i/group;
   define mean / analysis;
run;&lt;/PRE&gt;
&lt;P&gt;As soon as you want the mean of another variable you can't use it on the column statement. But a specific define may get you around that:&lt;/P&gt;
&lt;PRE&gt;data example;
  do i= 1 to 5;
   do j= 1 to 20;
     mean= rand('uniform');
     y   = rand('uniform');
     output;
   end;
  end;
run;

proc report data=example;
   column i mean,(min  max) y;
   define i/group;
   define mean / analysis;
   define y /mean;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may just be easier in the long run&amp;nbsp;to quit naming variables with keywords.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 21:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/603984#M76490</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-13T21:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT if a column variable is a statistic name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/604683#M76519</link>
      <description>&lt;P&gt;Thanks ballardw, Looks like I was doing the best thing by renaming the variable then, but explicitly using the define statement is an alternative.&lt;/P&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;First would be why are you creating variables with those names in first place.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;It may just be easier in the long run&amp;nbsp;to quit naming variables with keywords.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't create the variable ; SAS did, in an ODS table.&amp;nbsp;My original problem came about because I was using proc report on a data set produced using ODS output from proc mixed, but the ODS table includes the variable StdErr, which is one of the statistic keywords.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My fix was to rename StdErr. But the on-line SAS help for proc report gives the impression that there may be another solution.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=p1hagdk7qeis65n1659yii98d8s1.htm&amp;amp;locale=en" target="_self"&gt;&lt;SPAN class="xis-noteGenText"&gt;(From "Statistics That Are Available in PROC REPORT")&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="xis-noteGenText"&gt;Note:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;If a variable name (class or analysis) and a statistic name are the same, then enclose the statistic name in single quotation marks (for example,&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="xis-codeDefaultStyle"&gt;'MAX'&lt;/CODE&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But it looks like this proc report help page has been copied from PROC TABULATE without editing the content (the giveaway being it mentions the TABLE statement).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2019 10:54:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/604683#M76519</guid>
      <dc:creator>JohnHoughton</dc:creator>
      <dc:date>2019-11-16T10:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT if a column variable is a statistic name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/610573#M76778</link>
      <description>&lt;P&gt;The error in the online help for Proc Report has been corrected now&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 22:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT-if-a-column-variable-is-a-statistic-name/m-p/610573#M76778</guid>
      <dc:creator>JohnHoughton</dc:creator>
      <dc:date>2019-12-09T22:17:24Z</dc:date>
    </item>
  </channel>
</rss>

