<?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 columns in ALTER statement in PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703360#M215491</link>
    <description>&lt;P&gt;You will get ALL variables, unless you drop them:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x $ y $;
datalines;
a b
;

data want;
set have;
z = cats(x,y);
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;  x    y    z

  a    b    ab
&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Dec 2020 13:07:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-12-03T13:07:03Z</dc:date>
    <item>
      <title>Concatenate columns in ALTER statement in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703347#M215483</link>
      <description>&lt;P&gt;How can I concatenate multiple columns in PROC SQL statement using ALTER? And I don't want to use SELECT statement since in that case, I will have to mention all the columns and the table on which I am working has more than 100 columns whereas in the ALTER statement you just need to mention the column you are adding.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 11:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703347#M215483</guid>
      <dc:creator>Saurabh_Rana</dc:creator>
      <dc:date>2020-12-03T11:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate columns in ALTER statement in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703350#M215485</link>
      <description>&lt;P&gt;The ALTER TABLE statement can be used to just add a column, but it will initialize it with missing values. You need to also use an UPDATE that sets the values as needed.&lt;/P&gt;
&lt;P&gt;I would rather use a DATA step to do this (add a column and use concatenation of values to populate it).&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 12:30:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703350#M215485</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-03T12:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate columns in ALTER statement in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703355#M215489</link>
      <description>But with the data step, I will only get the concatenated column in output table but I want the concatenated column along with the other 100 columns. What is the best way to achieve this output?</description>
      <pubDate>Thu, 03 Dec 2020 12:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703355#M215489</guid>
      <dc:creator>Saurabh_Rana</dc:creator>
      <dc:date>2020-12-03T12:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate columns in ALTER statement in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703360#M215491</link>
      <description>&lt;P&gt;You will get ALL variables, unless you drop them:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x $ y $;
datalines;
a b
;

data want;
set have;
z = cats(x,y);
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;  x    y    z

  a    b    ab
&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Dec 2020 13:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-columns-in-ALTER-statement-in-PROC-SQL/m-p/703360#M215491</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-03T13:07:03Z</dc:date>
    </item>
  </channel>
</rss>

