<?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: format all column names that are similar in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682625#M24420</link>
    <description>Thank you very much for this tip!</description>
    <pubDate>Wed, 09 Sep 2020 13:21:42 GMT</pubDate>
    <dc:creator>nesslee</dc:creator>
    <dc:date>2020-09-09T13:21:42Z</dc:date>
    <item>
      <title>format all column names that are similar</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682601#M24417</link>
      <description>&lt;P&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;&lt;FONT color="#000000"&gt;Hello everyone,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;&lt;FONT color="#000000"&gt;I would like to format all my columns that are number as below:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; MyAmount_201912 / &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;style&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(column)={tagattr=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'format:#,##0.00'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;};&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;define&lt;/FONT&gt; MyAmount_202001 / &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;style&lt;/FONT&gt;(column)={tagattr=&lt;FONT face="Courier New" size="3" color="#800080"&gt;'format:#,##0.00'&lt;/FONT&gt;};&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;But instead of defining every column name like above (MyAmount_201912, etc.), I would like to say in my coding : do this style for all column names that begin with, or I would like to say format this for all columns that are in number format.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;The reason I would like to set&amp;nbsp;this&amp;nbsp;logic is because the names of some columns are calculated and it might be different in each run.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Do you see a way to set this logic?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 12:20:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682601#M24417</guid>
      <dc:creator>nesslee</dc:creator>
      <dc:date>2020-09-09T12:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: format all column names that are similar</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682608#M24418</link>
      <description>If your SAS is above 9.4 .&lt;BR /&gt;&lt;BR /&gt;define MyAmount_:  / style(column)={tagattr='format:#,##0.00'};</description>
      <pubDate>Wed, 09 Sep 2020 12:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682608#M24418</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-09T12:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: format all column names that are similar</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682619#M24419</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Do you see a way to set this logic?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, the idea of creating columns in a data set with year and month numbers in the variable name is really the problem. This is completely unnecessary and leads to the problem you are having and should be avoided. If instead, you have a long data set with a variable named MyAccount and many rows where the month and year are actual data values, then you can use the ACROSS option in PROC REPORT for variable MyAccount and it takes care of naming and formatting the resulting columns in the report.&amp;nbsp;SAS has already programmed this, so you don't have to!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So you can save yourself the time and trouble of creating these columns in a wide data set with month and year in the variable name, and simply use a long data set and the ACROSS option to automatically create the desired columns in your report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then this problem that you mentioned&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;The reason I would like to set this logic is because the names of some columns are calculated and it might be different in each run.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;goes away completely. Example on made up data (where you can see that this works, regardless of the months in the data set — try it!)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data made_up_data;
	length planet $ 5;
    do i=0 to 11;
		do j=1 to 2;
	     month=intnx('month',today(),-i,'b');
		 planet='Mars';
		 y=rand('normal');
		 output;
		 planet='Earth';
		 y=rand('normal');
		 output;
		 planet='Pluto'; /* Yes, Pluto is a planet */
		 y=rand('normal');
		 output;
		 end;
	end;
	drop i j;
	format month yymm9.;
run;

proc report data=made_up_data;
	columns planet month,y;
	define planet/group;
	define month/across; /* This is the important step, where month is considered an ACROSS variable */
	define y/mean 'Perihelion' format=8.2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 13:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682619#M24419</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-09T13:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: format all column names that are similar</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682625#M24420</link>
      <description>Thank you very much for this tip!</description>
      <pubDate>Wed, 09 Sep 2020 13:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682625#M24420</guid>
      <dc:creator>nesslee</dc:creator>
      <dc:date>2020-09-09T13:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: format all column names that are similar</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682627#M24421</link>
      <description>thank you a lot for your suggestion and example!</description>
      <pubDate>Wed, 09 Sep 2020 13:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/format-all-column-names-that-are-similar/m-p/682627#M24421</guid>
      <dc:creator>nesslee</dc:creator>
      <dc:date>2020-09-09T13:22:29Z</dc:date>
    </item>
  </channel>
</rss>

