<?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: With proc transpose, how do you rename  columns with specific values from a variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901384#M356237</link>
    <description>Thank you for your insight. This is only a step before creating a table using proc report.</description>
    <pubDate>Fri, 03 Nov 2023 12:51:30 GMT</pubDate>
    <dc:creator>ANKH1</dc:creator>
    <dc:date>2023-11-03T12:51:30Z</dc:date>
    <item>
      <title>With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901162#M356143</link>
      <description>&lt;P&gt;I have this output:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;mean&lt;/TD&gt;&lt;TD&gt;min_max&lt;/TD&gt;&lt;TD&gt;median&lt;/TD&gt;&lt;TD&gt;group&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;1-40&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;Chef/owner&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;TD&gt;2-45&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;Chef's assistant&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;4-39&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;TD&gt;Waiter&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With proc transpose I get this:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_NAME_&lt;/TD&gt;&lt;TD&gt;COL1&lt;/TD&gt;&lt;TD&gt;COL2&lt;/TD&gt;&lt;TD&gt;COL3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;mean&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;min_max&lt;/TD&gt;&lt;TD&gt;1-40&lt;/TD&gt;&lt;TD&gt;2-45&lt;/TD&gt;&lt;TD&gt;4-39&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;median&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I would like rename the COL1, COL2, COL3 in the same procedure so it can look like this:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_NAME_&lt;/TD&gt;&lt;TD&gt;Chef/owner&lt;/TD&gt;&lt;TD&gt;Chef's assistant&lt;/TD&gt;&lt;TD&gt;Waiter&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;mean&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;min_max&lt;/TD&gt;&lt;TD&gt;1-40&lt;/TD&gt;&lt;TD&gt;2-45&lt;/TD&gt;&lt;TD&gt;4-39&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;median&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I need the output to look like this since this will be used in a macro. I want to avoid renaming each col with a specific name since this macro will also be used for other grouping variable (other that chef/owner, chef´s assistant and waiter).&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 21:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901162#M356143</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-11-01T21:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901163#M356144</link>
      <description>&lt;P&gt;Use the ID statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input mean  min_max $  median  group $20.;
cards;
32  1-40  35  Chef/owner
33  2-45  31  Chef's assistant
31  4-39  28  Waiter
;

proc transpose data=have out=want;
  id group;
  var mean min_max median;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course that will make them all as CHARACTER variables to be able to hold strings like '2-45'.&amp;nbsp; So values like 32 will get converted to&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'          32'&lt;/PRE&gt;
&lt;P&gt;And SAS will have to convert those strange group names into actual variable names.&lt;/P&gt;
&lt;PRE&gt;                                    Chef_s_
Obs    _NAME_      Chef_owner      assistant         Waiter

 1     mean                 32              33              31
 2     min_max    1-40            2-45            4-39
 3     median               35              31              28

&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2023 21:38:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901163#M356144</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-01T21:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901167#M356145</link>
      <description>&lt;P&gt;Personally I find any variable that has two values, i.e. Min and MAX in a single variable basically a failure waiting to happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that you need a data set? It might be easier, especially if your "min_max" was two separate numeric variable to create a report with appearance as desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless you read data in that strange format, might even be easier than starting with this summary.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 22:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901167#M356145</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-11-01T22:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901216#M356160</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would you do such a transpose in the first place? If you are doing this to create a report, don't transpose, use PROC REPORT. You will have many more options for controlling the column names. Please let us know if you are trying to create a report.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 11:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901216#M356160</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-02T11:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901382#M356235</link>
      <description>Thank you!</description>
      <pubDate>Fri, 03 Nov 2023 12:46:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901382#M356235</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-11-03T12:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901383#M356236</link>
      <description>Thank you for your insight. The min-max is a character value.</description>
      <pubDate>Fri, 03 Nov 2023 12:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901383#M356236</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-11-03T12:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901384#M356237</link>
      <description>Thank you for your insight. This is only a step before creating a table using proc report.</description>
      <pubDate>Fri, 03 Nov 2023 12:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901384#M356237</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-11-03T12:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: With proc transpose, how do you rename  columns with specific values from a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901387#M356239</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you for your insight. This is only a step before creating a table using proc report.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;you do NOT want to do a transpose before PROC REPORT.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 13:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/With-proc-transpose-how-do-you-rename-columns-with-specific/m-p/901387#M356239</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-03T13:15:14Z</dc:date>
    </item>
  </channel>
</rss>

