<?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: Custom prefixes in proc means? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639680#M190348</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/95638"&gt;@UniversitySas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think that it is possible to achieve this in a PROC MEANS.&lt;/P&gt;
&lt;P&gt;Here is an alternative approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data = have;
        by date;
        var first1-first10 second1-second10;
    output out = table mean= / autoname;
run;

%let statistic = Mean; /*Select one the following: Min Max Sum StdDev Mean*/

proc sql noprint;
	select catt(name,"= &amp;amp;statistic._",scan(name,1,'_'))
	into: newnames separated by " "
	from dictionary.columns
 	where libname="WORK" and memname="TABLE" and find(name,"&amp;amp;statistic.")&amp;gt;0;
quit;

proc datasets lib=WORK nolist;
  modify TABLE;
    rename &amp;amp;newnames.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
    <pubDate>Tue, 14 Apr 2020 10:07:47 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-04-14T10:07:47Z</dc:date>
    <item>
      <title>Custom prefixes in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639655#M190332</link>
      <description>&lt;P&gt;I know there is an autoname feature in proc means,&lt;/P&gt;&lt;P&gt;but I was wondering if there were a simple way to do something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data = have;
        by date;
        var first1-first10 second1-second10;
    output out = table mean(first1-first10) = mean_(first1-first10);
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I know the above code doesnt work, but instead of typing out&lt;/P&gt;&lt;P&gt;mean(first1-first10) = mean_first1 mean_first2 mean_first3....&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a quicker was to do this? Even if in a data step or proc sql?&lt;/P&gt;&lt;P&gt;I think /autoname wouldn't work here, because it would give me first1_mean, first2_mean ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 07:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639655#M190332</guid>
      <dc:creator>UniversitySas</dc:creator>
      <dc:date>2020-04-14T07:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Custom prefixes in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639680#M190348</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/95638"&gt;@UniversitySas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think that it is possible to achieve this in a PROC MEANS.&lt;/P&gt;
&lt;P&gt;Here is an alternative approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data = have;
        by date;
        var first1-first10 second1-second10;
    output out = table mean= / autoname;
run;

%let statistic = Mean; /*Select one the following: Min Max Sum StdDev Mean*/

proc sql noprint;
	select catt(name,"= &amp;amp;statistic._",scan(name,1,'_'))
	into: newnames separated by " "
	from dictionary.columns
 	where libname="WORK" and memname="TABLE" and find(name,"&amp;amp;statistic.")&amp;gt;0;
quit;

proc datasets lib=WORK nolist;
  modify TABLE;
    rename &amp;amp;newnames.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 10:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639680#M190348</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-04-14T10:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Custom prefixes in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639695#M190361</link>
      <description>&lt;P&gt;You could rename them as this way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
date='xx';
input f1-f4;
cards;
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
;
proc summary data=have;
by date;
var f1-f4;
output out=want(rename=(f1-f4=mean_f1-mean_f4)) mean= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Apr 2020 11:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639695#M190361</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-04-14T11:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Custom prefixes in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639703#M190366</link>
      <description>&lt;P&gt;It should be straightforward:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
   var first1-first10 second1-second10;
   output out=want mean=mean_first1-mean_first10 mean_second1-mean_second10;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is untested code, so see if it works for your data.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 11:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Custom-prefixes-in-proc-means/m-p/639703#M190366</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-04-14T11:51:59Z</dc:date>
    </item>
  </channel>
</rss>

