<?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: Joining multiple columns into one and then doing the reverse of that after conducting analysis in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940544#M45155</link>
    <description>&lt;P&gt;Why do you exclude cat4 and cat5?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2024 20:48:47 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-08-22T20:48:47Z</dc:date>
    <item>
      <title>Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940533#M45153</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to join multiple columns that have the same type of data, into 1 column so that I'm able to conduct analysis on just 1 column instead of multiple columns with the same type of data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an example of how the data is currently structured&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;item cat1&amp;nbsp; cat2&amp;nbsp; cat3&amp;nbsp; cat4&amp;nbsp; cat5&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp; &amp;nbsp; 111&amp;nbsp; &amp;nbsp;222&amp;nbsp; &amp;nbsp;333&amp;nbsp; &amp;nbsp;444&amp;nbsp; &amp;nbsp;555&amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;B&amp;nbsp; &lt;SPAN&gt;&amp;nbsp;&amp;nbsp;666&amp;nbsp; &amp;nbsp;777&amp;nbsp; &amp;nbsp;888&amp;nbsp; &amp;nbsp;999&amp;nbsp; &amp;nbsp;101&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;C&amp;nbsp; &lt;SPAN&gt;&amp;nbsp; 112&amp;nbsp; &amp;nbsp;212&amp;nbsp; &amp;nbsp;313&amp;nbsp; &amp;nbsp;414&amp;nbsp; &amp;nbsp;515&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;D &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;123&amp;nbsp; &amp;nbsp;234&amp;nbsp; &amp;nbsp;567&amp;nbsp; &amp;nbsp;890&amp;nbsp; &amp;nbsp;145&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the data to look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;item cat1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp; &amp;nbsp; 111&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp; &amp;nbsp; 222&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp; &amp;nbsp; 333&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B&amp;nbsp; &amp;nbsp; 666&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B&amp;nbsp; &amp;nbsp; 777&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B&amp;nbsp; &amp;nbsp; 888&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;C&amp;nbsp; &amp;nbsp; 999&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;C&amp;nbsp; &amp;nbsp; 555&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;C&amp;nbsp; &amp;nbsp; 101&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;D&amp;nbsp; &amp;nbsp; 789&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;D&amp;nbsp; &amp;nbsp; 456&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data Want;
set Have ;
cat 1 = cat 2;
keep cat 1 ;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;I would also like to know how to get the data back to the original structure once I've completed my analysis please ?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 21:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940533#M45153</guid>
      <dc:creator>AB1976</dc:creator>
      <dc:date>2024-08-22T21:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940544#M45155</link>
      <description>&lt;P&gt;Why do you exclude cat4 and cat5?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 20:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940544#M45155</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-22T20:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940545#M45156</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; Are you referring to the data step?&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Aug 2024 20:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940545#M45156</guid>
      <dc:creator>AB1976</dc:creator>
      <dc:date>2024-08-22T20:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940546#M45157</link>
      <description>&lt;P&gt;Proc Transpose will often do what you are requesting:&lt;/P&gt;
&lt;P&gt;Note the data step to provide example data. This is the preferred way to share data on the forum as we can see pretty quickly what the variable types and properties (formats, labels) may be. Copy text from your editor, open a text box on the forum with the &amp;lt;/&amp;gt; icon that appears above the message window and paste.&lt;/P&gt;
&lt;PRE&gt;data have;
  input item $ cat1  cat2  cat3  cat4  cat5 ;
datalines;
A    111   222   333   444   555   
B    666   777   888   999   101             
C    112   212   313   414   515 
D    123   234   567   890   145     
;
/* if not actually sorted*/
proc sort data=have;
   by item;
run;

proc transpose data=have out=want
     prefix=cat;
by item;
var cat1 - cat5;
run;
   
/* leave the _name_ variable in the data!!*/
/* IF you do anything to that set may need to 
resort. If you add variables you have to describe 
what you expect to do */

Proc transpose data=want out=original (drop=_name_);
  by item;
  id _name_;
  var cat1;
run;
&lt;/PRE&gt;
&lt;P&gt;Proc transpose seldom gets what you want with a mix of numeric and character variables (placing both in one column means that the column is character).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF you have multiple rows of identical Item (or other BY variables) then the problem may be a bit stickier as you may end up with more than one variable in the first transpose. Which means a different approach of simulating the first transpose. And may require adding more information to the data to "get back" to original.&lt;/P&gt;
&lt;P&gt;Personally I would make sure not to lose the original data set.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 21:00:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940546#M45157</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-22T21:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940549#M45158</link>
      <description>thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;the data I have is from a data set that I've already ran/created can i still use the same code ?</description>
      <pubDate>Thu, 22 Aug 2024 21:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940549#M45158</guid>
      <dc:creator>AB1976</dc:creator>
      <dc:date>2024-08-22T21:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940551#M45159</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468362"&gt;@AB1976&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;the data I have is from a data set that I've already ran/created can i still use the same code ?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Make sure that you don't overwrite your original data and go ahead and test it. The data step I wrote was just to have something to demonstrate one basic approach if the data is as clean as you showed with the example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the Proc transpose code I show assumes your observations are sorted. If that is not the case you &lt;STRONG&gt;might&lt;/STRONG&gt; be able to use the NOTSORTED option on the BY in the Proc Transpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I included all the variables. If you don't include all of the variables then you will have to make a very clear description of what "doing the reverse" would entail. The bit you showed only showed apparently transposing 3 of the 5 Cat variables in the example. Once those values are gone there really would be no way to recover them from the shown process. Something could be done but details would matter.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 22:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940551#M45159</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-22T22:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940568#M45160</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468362"&gt;@AB1976&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; Are you referring to the data step?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your "want" data does not have the values from these variables.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 06:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940568#M45160</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-23T06:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940571#M45161</link>
      <description>Looking at the data, your objective is clear as mud. So here is an approach that might work, but will at least gets the dialog moving in a productive direction.&lt;BR /&gt;First, create a data set with your "combined" variable:&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;comb = cat(cat1, cat2, cat3);&lt;BR /&gt;run;&lt;BR /&gt;So both the original variables as well as the combined variable are now in your data.&lt;BR /&gt;Or perhaps move in the other direction:&lt;BR /&gt;data want:&lt;BR /&gt;set have;&lt;BR /&gt;v = var1;&lt;BR /&gt;output;&lt;BR /&gt;v = var2;&lt;BR /&gt;output;&lt;BR /&gt;v = var3;&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Next, conduct your analysis but use any variables you like.&lt;BR /&gt;At the end, drop the variables or observations that you no longer need to return the data to its original form.</description>
      <pubDate>Fri, 23 Aug 2024 07:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940571#M45161</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-08-23T07:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple columns into one and then doing the reverse of that after conducting analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940580#M45162</link>
      <description>&lt;P&gt;PS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fact that you already need to transpose for analysis is an asteroid-sized hint that your wide data structure is crap for working with it. Stay with the long format, and create wide reports where needed with the reporting procedures.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 09:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Joining-multiple-columns-into-one-and-then-doing-the-reverse-of/m-p/940580#M45162</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-23T09:01:38Z</dc:date>
    </item>
  </channel>
</rss>

