<?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 Multi-Format Column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952188#M372156</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have this table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA SALE;
	INPUT VARIABLE M1 M2 M3 M4 M5;
	CARDS;

1  0.52 0.36 0.98 0.74 0.99 
2  36 52 2 6 42 
3  0.96 0.55 0.44 0.7 0.32
4  65 8 24 6 21
5  0.63 0.36 0.54 0.8 0.7
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would like to get the following result: if the variable is 1, 3 or 5 then the format of the cell is displayed as a percentage like this:&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="pourcent.png" style="width: 410px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102599iA888946A58688C4D/image-dimensions/410x127?v=v2" width="410" height="127" role="button" title="pourcent.png" alt="pourcent.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;How can I do this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Nov 2024 23:44:37 GMT</pubDate>
    <dc:creator>sasuser_8</dc:creator>
    <dc:date>2024-11-29T23:44:37Z</dc:date>
    <item>
      <title>Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952188#M372156</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have this table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA SALE;
	INPUT VARIABLE M1 M2 M3 M4 M5;
	CARDS;

1  0.52 0.36 0.98 0.74 0.99 
2  36 52 2 6 42 
3  0.96 0.55 0.44 0.7 0.32
4  65 8 24 6 21
5  0.63 0.36 0.54 0.8 0.7
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would like to get the following result: if the variable is 1, 3 or 5 then the format of the cell is displayed as a percentage like this:&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="pourcent.png" style="width: 410px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102599iA888946A58688C4D/image-dimensions/410x127?v=v2" width="410" height="127" role="button" title="pourcent.png" alt="pourcent.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;How can I do this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2024 23:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952188#M372156</guid>
      <dc:creator>sasuser_8</dc:creator>
      <dc:date>2024-11-29T23:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952189#M372157</link>
      <description>&lt;P&gt;PROC REPORT will provide the formatting you want.&amp;nbsp;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-different-formats-for-different-rows/td-p/403157" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-different-formats-for-different-rows/td-p/403157&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: this provides a report, you cannot have a SAS data set with different formatting in a column.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2024 00:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952189#M372157</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-11-30T00:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952202#M372160</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sale2;
	set sale;
	array m m1-m5;
	if mod(variable,2)=0 then do i=1 to 5;
	    m(i)=m(i)/100;
    end;
run;
proc report data=sale2;
	columns variable m1-m5;
	define variable/display;
	define m1/display;
	define m2/display;
	define m3/display;
	define m4/display;
	define m5/display;
	compute m1;
		if mod(variable,2)=0 then do;
           call define('m1','format','percent8.0');
        end;
    endcompute;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Two things to note above:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the percents (0 to 100 scale) in your original data need to be converted to proportions (0 to 1 scale) in your data in order for this to work, so we divide by 100&lt;/LI&gt;
&lt;LI&gt;I have only shown how to change column M1 to have the percent format. I leave it to you as a homework assignment to make this work for the other columns.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 30 Nov 2024 11:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952202#M372160</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-11-30T11:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952207#M372163</link>
      <description>&lt;P&gt;Correction to the above code. I was making the even numbered rows the percents, however you wanted the odd numbered rows to be the percents. So, no need to divide by 100, take that out. Instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;mod(variable,2)=0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in both place where it appears, you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;mod(variable,2)=1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2024 16:59:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952207#M372163</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-11-30T16:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952232#M372173</link>
      <description>&lt;P&gt;To show how a long layout can make coding simpler:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sale;
input variable m1-m5;
datalines;
1  0.52 0.36 0.98 0.74 0.99 
2  36 52 2 6 42 
3  0.96 0.55 0.44 0.7 0.32
4  65 8 24 6 21
5  0.63 0.36 0.54 0.8 0.7
;

proc transpose data=sale out=long;
by variable;
var m:;
run;

proc report data=long;
column variable col1,_name_;
define variable / group;
define col1 / "" analysis;
define _name_ / "" across;
compute col1;
  if mod(variable,2) = 1 then call define(_col_,"format","percent8.0");
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 01 Dec 2024 11:29:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952232#M372173</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-01T11:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952242#M372174</link>
      <description>&lt;P&gt;The topic title is "multi-format" column.&amp;nbsp; And the correct answer is a column can't have more than one format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it CAN have a multi-component format (as in sometimes %, sometimes integer).&amp;nbsp; You can't base those components on the value of the VARIABLE column, but it appears that for the odd values of VARIABLE, the M variables all range from zero-through-one, and for all others look like integers greater than one.&amp;nbsp; So define a different format for each of those ranges, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sale;
  input variable m1-m5;
datalines;
1   0.52   0.36  0.98 0.74  0.99 
2  36     52     2    6    42 
3   0.96   0.55  0.44 0.7   0.32
4  65      8    24    6    21
5  0.63    0.36  0.54 0.8   0.7
run;

proc format;
  value ff  0-1=[percent8.0]
            1&amp;lt;-high=[comma8.0];
run;

proc print data=sale noobs;
  format m: ff.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yielding:&lt;/P&gt;
&lt;DIV class="branch"&gt;&lt;A target="_blank" name="IDX"&gt;&lt;/A&gt;
&lt;TABLE class="systitleandfootercontainer" border="0" summary="Page Layout" width="100%" frame="void" rules="none" cellspacing="1" cellpadding="1"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="c systemtitle"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;BR /&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table lia-align-right" summary="Procedure Print: Data Set WORK.SALE" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;variable&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;m1&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;m2&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;m3&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;m4&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;m5&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;52%&lt;/TD&gt;
&lt;TD class="r data"&gt;36%&lt;/TD&gt;
&lt;TD class="r data"&gt;98%&lt;/TD&gt;
&lt;TD class="r data"&gt;74%&lt;/TD&gt;
&lt;TD class="r data"&gt;99%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="r data"&gt;36&lt;/TD&gt;
&lt;TD class="r data"&gt;52&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="r data"&gt;6&lt;/TD&gt;
&lt;TD class="r data"&gt;42&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="r data"&gt;96%&lt;/TD&gt;
&lt;TD class="r data"&gt;55%&lt;/TD&gt;
&lt;TD class="r data"&gt;44%&lt;/TD&gt;
&lt;TD class="r data"&gt;70%&lt;/TD&gt;
&lt;TD class="r data"&gt;32%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="r data"&gt;65&lt;/TD&gt;
&lt;TD class="r data"&gt;8&lt;/TD&gt;
&lt;TD class="r data"&gt;24&lt;/TD&gt;
&lt;TD class="r data"&gt;6&lt;/TD&gt;
&lt;TD class="r data"&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;5&lt;/TD&gt;
&lt;TD class="r data"&gt;63%&lt;/TD&gt;
&lt;TD class="r data"&gt;36%&lt;/TD&gt;
&lt;TD class="r data"&gt;54%&lt;/TD&gt;
&lt;TD class="r data"&gt;80%&lt;/TD&gt;
&lt;TD class="r data"&gt;70%&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit note: the format above is the tweaked version.&amp;nbsp; It was:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value ff  1&amp;lt;-high=[comma8.0]
             other=[percent8.0];
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;observes, you must know that the rows that should have the percentage format have a range that does not intersect the range of the other rows.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 03:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952242#M372174</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-12-02T03:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952243#M372175</link>
      <description>&lt;P&gt;This relies on certain assumptions not stated in the original question. Without knowing that these assumptions are valid, I would not recommend this solution.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Dec 2024 22:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952243#M372175</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-12-01T22:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952324#M372194</link>
      <description>&lt;P&gt;It's elegant but I have another variable in my DB wich is less than 0 without being a percentage &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 19:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952324#M372194</guid>
      <dc:creator>sasuser_8</dc:creator>
      <dc:date>2024-12-02T19:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952325#M372195</link>
      <description>&lt;P&gt;&amp;nbsp;Is it possible to add an ARRAY in the PROC REPORT so as not to repeat the code for the 12 months ?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 19:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952325#M372195</guid>
      <dc:creator>sasuser_8</dc:creator>
      <dc:date>2024-12-02T19:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952329#M372199</link>
      <description>&lt;P&gt;What do you mean by "12 months"? There is no variable containing date values in your dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 20:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952329#M372199</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-02T20:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952336#M372203</link>
      <description>&lt;BR /&gt;I would like to insert an ARRAY in the PROC REPORT so as not to have to do the COMPUTE for each of my variables (m1,m2,m3,m4,m5).&lt;BR /&gt;&lt;BR /&gt;As we can see in this example but I'm not able to do it:&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/43/765.html" target="_blank"&gt;https://support.sas.com/kb/43/765.html&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Dec 2024 21:56:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952336#M372203</guid>
      <dc:creator>sasuser_8</dc:creator>
      <dc:date>2024-12-02T21:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952337#M372204</link>
      <description>&lt;P&gt;The code from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; above makes this easy. No alteration to the code is needed if you have 12 months instead of 5. Better to work from a long data set than a wide data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438581"&gt;@sasuser_8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;I would like to insert an ARRAY in the PROC REPORT so as not to have to do the COMPUTE for each of my variables (m1,m2,m3,m4,m5).&lt;BR /&gt;&lt;BR /&gt;As we can see in this example but I'm not able to do it:&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/43/765.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/43/765.html&lt;/A&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please don't tell us "I'm not able to do it" and then provide no other information. We don't know what you tried. We have no idea what went wrong. If there are errors in the log, show us the LOG. If the results are not what you want, show us the code, show us the incorrect output, and explain exactly what you want.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 22:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952337#M372204</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-12-02T22:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952338#M372205</link>
      <description>I tried this but the array is not recognized.&lt;BR /&gt;ERROR: Invalid column specification in CALL DEFINE.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DATA SALE;&lt;BR /&gt;	INPUT VARIABLE M1 M2 M3 M4 M5;&lt;BR /&gt;	CARDS;&lt;BR /&gt;&lt;BR /&gt;1  0.52 0.36 0.98 0.74 0.99 &lt;BR /&gt;2  36 52 2 6 42 &lt;BR /&gt;3  0.96 0.55 0.44 0.7 0.32&lt;BR /&gt;4  65 8 24 6 21&lt;BR /&gt;5  0.63 0.36 0.54 0.8 0.7&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc report data=sale;&lt;BR /&gt;	columns variable m1-m5 dummy;&lt;BR /&gt;	define variable/display;&lt;BR /&gt;	define m1/display;&lt;BR /&gt;	define m2/display;&lt;BR /&gt;	define m3/display;&lt;BR /&gt;	define m4/display;&lt;BR /&gt;	define m5/display;&lt;BR /&gt;	define dummy / computed noprint;&lt;BR /&gt;&lt;BR /&gt;	compute dummy;&lt;BR /&gt;		array v m1-m5;&lt;BR /&gt;&lt;BR /&gt;		do I=1 to dim(v);&lt;BR /&gt;			if variable in (1,3,5) then&lt;BR /&gt;				do;&lt;BR /&gt;					call define('V[I]','format','percent8.0');&lt;BR /&gt;				end;&lt;BR /&gt;				end;&lt;BR /&gt;		endcomp;&lt;BR /&gt;run;</description>
      <pubDate>Mon, 02 Dec 2024 22:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952338#M372205</guid>
      <dc:creator>sasuser_8</dc:creator>
      <dc:date>2024-12-02T22:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952339#M372206</link>
      <description>&lt;P&gt;The code from &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_blank"&gt;@Kurt_Bremser&lt;/A&gt; above makes this easy. No alteration to the code is needed if you have 12 months instead of 5.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 22:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952339#M372206</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-12-02T22:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952345#M372207</link>
      <description>I tried with a colleague to transpose this method into my real program but it is too complicated for us. &lt;BR /&gt;&lt;BR /&gt;The simplest thing for me would be to do the compute with an array, if that's possible.</description>
      <pubDate>Mon, 02 Dec 2024 22:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952345#M372207</guid>
      <dc:creator>sasuser_8</dc:creator>
      <dc:date>2024-12-02T22:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952351#M372210</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438581"&gt;@sasuser_8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;I would like to insert an ARRAY in the PROC REPORT so as not to have to do the COMPUTE for each of my variables (m1,m2,m3,m4,m5).&lt;BR /&gt;&lt;BR /&gt;As we can see in this example but I'm not able to do it:&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/43/765.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/43/765.html&lt;/A&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No need for an array. Both&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s and my code work for all the M: variables. Just try it.&lt;/P&gt;
&lt;P&gt;But what has that got to do with months?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 23:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952351#M372210</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-02T23:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952352#M372211</link>
      <description>&lt;P&gt;Then show your "real program". And your "real" data structure. We can only help you with stuff we see, we're not in the mentalist business.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 23:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952352#M372211</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-02T23:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952361#M372213</link>
      <description>&lt;P&gt;The other option is to simply make all your M: columns character variables - this works fine and will allow you to use arrays as seems to be your preference.&amp;nbsp; If you output to Excel afterwards, it may or may not interpret them as numbers:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA SALE;
	INPUT VARIABLE M1 M2 M3 M4 M5;
	CARDS;

1  0.52 0.36 0.98 0.74 0.99 
2  36 52 2 6 42 
3  0.96 0.55 0.44 0.7 0.32
4  65 8 24 6 21
5  0.63 0.36 0.54 0.8 0.7
;
RUN;

data sale;
set sale;
length mon1-mon5 $15;
array mon {*} mon1-mon5;
array m {*} m1-m5;
do i=1 to dim(m);
	if mod(_N_,2) then mon[i]=put(m[i],percent8.1);
	else mon[i]=put(m[i],comma8.0);
end;
drop m1-m5 i;
run;

proc print data=sale noobs width=min; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;...resulting in:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="quickbluefish_0-1733189467125.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102646i639D1223EF9C3905/image-size/medium?v=v2&amp;amp;px=400" role="button" title="quickbluefish_0-1733189467125.png" alt="quickbluefish_0-1733189467125.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...obviously, you'll need to choose the appropriate formats for your data - for ex., if you have integers of 100M or larger, you'll need something longer than comma8.0.&amp;nbsp; Likewise if you have floating point numbers instead of all integers.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 01:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952361#M372213</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2024-12-03T01:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952366#M372216</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA SALE;
INPUT VARIABLE M1 M2 M3 M4 M5;
CARDS;

1 0.52 0.36 0.98 0.74 0.99
2 36 52 2 6 42
3 0.96 0.55 0.44 0.7 0.32
4 65 8 24 6 21
5 0.63 0.36 0.54 0.8 0.7
;
RUN;


proc report data=sale nowd;
columns variable m1-m5 dummy;
define variable/display;
define m1/display;
define m2/display;
define m3/display;
define m4/display;
define m5/display;
define dummy / computed noprint;

compute dummy;
array v{*} m1-m5;

do I=1 to dim(v);
if variable in (1,3,5) then call define(vname(v{i}),'format','percent8.0');
end;
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1733192527952.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102648i42C1AE338484872A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1733192527952.png" alt="Ksharp_0-1733192527952.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 02:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952366#M372216</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-12-03T02:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Format Column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952379#M372225</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438581"&gt;@sasuser_8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It's elegant but I have another variable in my DB wich is less than 0 without being a percentage &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;"Less than 0 without being a percentage"?&amp;nbsp; Why is that a problem?&amp;nbsp; &amp;nbsp;Did you see that my revised solution did not format negatives as percentages?&amp;nbsp; You could be even more specific, using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value ff    0-1=[percent8.]
                 other=[comma8.0] ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This depends on values of zero through one (and only zero through one) always being intended as percentages.&amp;nbsp; So far you have not said your data violate that rule.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 05:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multi-Format-Column/m-p/952379#M372225</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-12-03T05:09:58Z</dc:date>
    </item>
  </channel>
</rss>

