<?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: concatenate all columns having same starting name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458666#M116420</link>
    <description>&lt;P&gt;That's because your actual variable names are classe_1, classe_2, etc., not class_1, class_2.&amp;nbsp; This would fix it (but would still have the issue of possibly removing too many blanks):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var = cats(of classe_: );&lt;/P&gt;</description>
    <pubDate>Mon, 30 Apr 2018 14:38:18 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-04-30T14:38:18Z</dc:date>
    <item>
      <title>concatenate all columns having same starting name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458175#M116248</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set that holds&amp;nbsp;20 columns classe_1, classe_2, classe_3....classe_20.&lt;/P&gt;&lt;P&gt;possibles classe values : 5, 4, 17, C, B2.&lt;/P&gt;&lt;P&gt;i would like to concatenate all columns that begins with class_&lt;/P&gt;&lt;P&gt;thanks for your help in advance&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Nasser&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 16:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458175#M116248</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2018-04-27T16:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate all columns having same starting name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458177#M116249</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var=cats(of class_:);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Apr 2018 16:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458177#M116249</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-27T16:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate all columns having same starting name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458192#M116251</link>
      <description>&lt;P&gt;From the documentation cats and related concatenation functions&amp;nbsp;will default to a length of 200 characters if not explicitly assigned prior to use. So if your 20 class variables have more than 10 characters each you may need to assign a maximum expected length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you want a space or comma between the classes then use Catx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var= catx(',', of class: );&lt;/P&gt;
&lt;P&gt;or (space between)&lt;/P&gt;
&lt;P&gt;var= catx(' ', of class: );&lt;/P&gt;
&lt;P&gt;or (and especially if people are to read this result) a comma and a space&lt;/P&gt;
&lt;P&gt;var= catx(', ', of class: );&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 14:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458192#M116251</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-22T14:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate all columns having same starting name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458528#M116372</link>
      <description>&lt;P&gt;hello novinosrin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help. but I get this message "The CATS function call does not have enough arguments" by attempting your suggestion.&lt;/P&gt;&lt;P&gt;however it works with&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;var= catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;''&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, of class: );&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 06:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458528#M116372</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2018-04-30T06:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate all columns having same starting name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458666#M116420</link>
      <description>&lt;P&gt;That's because your actual variable names are classe_1, classe_2, etc., not class_1, class_2.&amp;nbsp; This would fix it (but would still have the issue of possibly removing too many blanks):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var = cats(of classe_: );&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 14:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458666#M116420</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-30T14:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate all columns having same starting name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458671#M116421</link>
      <description>&lt;P&gt;You can use this macro, &amp;nbsp;just add you DATASET NAME and LIBRARY NAME into it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro getvars(lib,dsn);
    %global vlist;
    proc sql;
        select name into :vlist separated by ' '
        from dictionary.columns
        where memname = upcase("&amp;amp;dsn")
		and libname =upcase("&amp;amp;lib")
		and name like 'class%'
    ;quit;
%mend;

%getvars(LIBRARY,DATASET);

%Put &amp;amp;vlist&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 14:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-all-columns-having-same-starting-name/m-p/458671#M116421</guid>
      <dc:creator>emrancaan</dc:creator>
      <dc:date>2018-04-30T14:51:01Z</dc:date>
    </item>
  </channel>
</rss>

