<?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 Merging column names when transposing in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Merging-column-names-when-transposing/m-p/619450#M19394</link>
    <description>&lt;P&gt;When I'm transposing, I want my column names to be a merged version of 2 separate columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 1: is called "Topic", example:&amp;nbsp;Cars per household&lt;/P&gt;&lt;P&gt;Column 2: is called "Variable", example:&amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I transpose I want to merge these two columns and as a result have something like "Cars per household : 3"&lt;/P&gt;&lt;P&gt;Both column names are of the type character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried something like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;transpose data = mydataset out = transposed_data;

id Topic:Variable;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but that doesn't run which I expected.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 10:29:02 GMT</pubDate>
    <dc:creator>Jens89</dc:creator>
    <dc:date>2020-01-23T10:29:02Z</dc:date>
    <item>
      <title>Merging column names when transposing</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-column-names-when-transposing/m-p/619450#M19394</link>
      <description>&lt;P&gt;When I'm transposing, I want my column names to be a merged version of 2 separate columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 1: is called "Topic", example:&amp;nbsp;Cars per household&lt;/P&gt;&lt;P&gt;Column 2: is called "Variable", example:&amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I transpose I want to merge these two columns and as a result have something like "Cars per household : 3"&lt;/P&gt;&lt;P&gt;Both column names are of the type character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried something like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;transpose data = mydataset out = transposed_data;

id Topic:Variable;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but that doesn't run which I expected.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 10:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-column-names-when-transposing/m-p/619450#M19394</guid>
      <dc:creator>Jens89</dc:creator>
      <dc:date>2020-01-23T10:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Merging column names when transposing</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-column-names-when-transposing/m-p/619559#M19407</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/283672"&gt;@Jens89&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When I'm transposing, I want my column names to be a merged version of 2 separate columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column 1: is called "Topic", example:&amp;nbsp;Cars per household&lt;/P&gt;
&lt;P&gt;Column 2: is called "Variable", example:&amp;nbsp;3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I transpose I want to merge these two columns and as a result have something like "Cars per household : 3"&lt;/P&gt;
&lt;P&gt;Both column names are of the type character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried something like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;transpose data = mydataset out = transposed_data;

id Topic:Variable;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but that doesn't run which I expected.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;did you try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID topic variable;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: this will not be valid if Topic values are &lt;STRONG&gt;numeric or text starting with a digit&lt;/STRONG&gt; as SAS variable names don't allow digits in the first position. Reverse the order of the variables if this is the case.&lt;/P&gt;
&lt;P&gt;Also if the combinations of the ID variables could result in the same value such as&lt;/P&gt;
&lt;P&gt;Var1 Var2&lt;/P&gt;
&lt;P&gt;AB&amp;nbsp;&amp;nbsp; CD&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BCD&lt;/P&gt;
&lt;P&gt;would both attempt to create a variable "ABCD" would be invalid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example with a data set you should have available:&lt;/P&gt;
&lt;PRE&gt;proc transpose data=sashelp.class
   out=work.trans
   ;
id name age;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise post example data and what you want for output from that example data. It isn't clear if you have an existing "variable" named variable or not.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 15:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-column-names-when-transposing/m-p/619559#M19407</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-23T15:39:28Z</dc:date>
    </item>
  </channel>
</rss>

