<?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: Combining 460 variables into 1 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343908#M78992</link>
    <description>&lt;P&gt;Well, you haven't shown what you actually tried. &amp;nbsp;So here's a guess as to why it didn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable you use to hold all 460 values has to be long enough:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length newvar&amp;nbsp;$ 15000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, once you realize how long the variable needs to be, you may have second thoughts about combining all 460 values. &amp;nbsp;There might be a way to get where you need to go, while still leaving the data as 460 separate variables. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, if you are going to search for a particular string within, you might be making your life harder. &amp;nbsp;That string might appear multiple times, and finding all of them would become more difficult.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2017 22:53:54 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-03-23T22:53:54Z</dc:date>
    <item>
      <title>Combining 460 variables into 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343884#M78983</link>
      <description>&lt;P&gt;I have up to 460 variables per person (test results). So I would like to combine all of these into 1 variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id&amp;nbsp;result1 result2.... result460&lt;/P&gt;
&lt;P&gt;x1 alcohol&lt;/P&gt;
&lt;P&gt;x2 alcohol &amp;nbsp;opioid fentanyl&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using the&amp;nbsp;catx function but did not work, not all resuls were combined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you,&lt;/P&gt;
&lt;P&gt;malena&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 21:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343884#M78983</guid>
      <dc:creator>malena</dc:creator>
      <dc:date>2017-03-23T21:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 460 variables into 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343889#M78985</link>
      <description>&lt;P&gt;What did you try?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post the code and what happened that makes you think it's incorrect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My suggestion would be CATX().&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 21:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343889#M78985</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-23T21:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 460 variables into 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343893#M78988</link>
      <description>&lt;P&gt;It would help if you explained what you want to achieve. Combining the data is easy, however it may or may not result in anything that will help you do what you ultimately want to obtain.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 21:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343893#M78988</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-23T21:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 460 variables into 1and them only search this one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343896#M78989</link>
      <description>no attachments. -##&lt;BR /&gt;Ultimately i am going to do a text search for specific results names,  do don't want to have to search all 460 columns,  so want to put all of these into 1 and only do the text search once</description>
      <pubDate>Thu, 23 Mar 2017 22:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343896#M78989</guid>
      <dc:creator>malena</dc:creator>
      <dc:date>2017-03-23T22:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 460 variables into 1and them only search this one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343899#M78990</link>
      <description>&lt;P&gt;I think that would be easier if you made the file long. e.g.:&lt;/P&gt;
&lt;PRE&gt;data have;
  input (id result1 result2 result460) ($);
  cards;
x1 alcohol . .
x2 alcohol  opioid fentanyl
;
proc transpose data=have out=want (drop=_:);
  by id notsorted;
  var result1--result460;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 22:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343899#M78990</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-23T22:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 460 variables into 1and them only search this one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343900#M78991</link>
      <description>&lt;P&gt;Have you looked at WHICHC function? It can take an array of values as second argument.&lt;/P&gt;
&lt;P&gt;Or a transpose to a long format then you could filter via a single WHERE query.&lt;/P&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;</description>
      <pubDate>Thu, 23 Mar 2017 22:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343900#M78991</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-23T22:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 460 variables into 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343908#M78992</link>
      <description>&lt;P&gt;Well, you haven't shown what you actually tried. &amp;nbsp;So here's a guess as to why it didn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable you use to hold all 460 values has to be long enough:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length newvar&amp;nbsp;$ 15000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, once you realize how long the variable needs to be, you may have second thoughts about combining all 460 values. &amp;nbsp;There might be a way to get where you need to go, while still leaving the data as 460 separate variables. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, if you are going to search for a particular string within, you might be making your life harder. &amp;nbsp;That string might appear multiple times, and finding all of them would become more difficult.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 22:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343908#M78992</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-23T22:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 460 variables into 1</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343949#M79001</link>
      <description>&lt;P&gt;catx will work if the target variable is large enough&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length oneVar $5500;
oneVar = catx(" ", of result:);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 03:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-460-variables-into-1/m-p/343949#M79001</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-03-24T03:18:55Z</dc:date>
    </item>
  </channel>
</rss>

