<?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: Concatenating too many variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441391#M110418</link>
    <description>&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;NEWVAR = cat(of VAR1-VAR100);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if you want to use the explicit list that you had.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Mar 2018 21:31:59 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-03-01T21:31:59Z</dc:date>
    <item>
      <title>Concatenating too many variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441351#M110395</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I need to concatenate almost 100 variables and I don't want to put a comma (,) after each one of them as it is too much of work. My variables has a sequence and it follows the pattern like var1, var2, var5, var11......&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to concatenate all of them with a short code like new_Var=CAT(var1-var100)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how my data looks like.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Have;
INPUT VAR1 VAR2$ VAR5 VAR10$;
DATALINES;
107 ENG1 10 NY
105 Bio2 15 ON
101 Che1 10 TX
107 Bio1 11 DL
105 Eng2 15 CA
100 Phy2 11 MR
105 Che1 15 DC
;
RUN&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone help me please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 20:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441351#M110395</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2018-03-01T20:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating too many variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441353#M110396</link>
      <description>&lt;P&gt;CATX and a variable list. This will include all varialbes that start with the prefix VAR:&lt;/P&gt;
&lt;P&gt;Depending on your naming convention you may need other options, google "SAS 9.4 variable lists" to see all the different ways of using abbreviations in your variable lists.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;want = catx(", ", of var:);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note, this works only in a data step since SQL doesn't support variable lists.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 20:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441353#M110396</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-01T20:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating too many variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441379#M110408</link>
      <description>Thanks Reza, this is so helpful. Do you think if there is a way to bring to concatenated data as separate line instead of side by side? Like for the first observation it will come like:&lt;BR /&gt;New_Var&lt;BR /&gt;107 &lt;BR /&gt;ENG1 &lt;BR /&gt;10 &lt;BR /&gt;NY</description>
      <pubDate>Thu, 01 Mar 2018 21:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441379#M110408</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2018-03-01T21:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating too many variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441381#M110409</link>
      <description>&lt;P&gt;It depends on the final output. SAS doesn't have a way of specifying line breaks in a variable that I know of...and I would probably leave that to my reporting step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is your final output destination? If it's HTML, perhaps a line break symbol may be needed, or if its RTF the appropriate tag would be needed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 21:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441381#M110409</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-01T21:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating too many variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441389#M110416</link>
      <description>Hi Reeza,&lt;BR /&gt;My final destination file is Excel. Thanks.</description>
      <pubDate>Thu, 01 Mar 2018 21:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441389#M110416</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2018-03-01T21:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating too many variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441390#M110417</link>
      <description>&lt;P&gt;Then that's the ALT+ENTER key you need and you can probably add that in. It won't show in the cell, and I'm not 100% sure Excel would recognize it properly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use ODS EXCEL you could go down the formula route and use CHAR(10) or "0A"x...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://excel.tips.net/T002788_Simulating_Alt_Enter_in_a_Formula.html" target="_blank"&gt;https://excel.tips.net/T002788_Simulating_Alt_Enter_in_a_Formula.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 21:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441390#M110417</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-01T21:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating too many variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441391#M110418</link>
      <description>&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;NEWVAR = cat(of VAR1-VAR100);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if you want to use the explicit list that you had.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 21:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-too-many-variables/m-p/441391#M110418</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-03-01T21:31:59Z</dc:date>
    </item>
  </channel>
</rss>

