<?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: How to combine two columns? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387964#M93051</link>
    <description>&lt;P&gt;Thank you so much for your great help!&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2017 20:35:13 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2017-08-14T20:35:13Z</dc:date>
    <item>
      <title>How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387468#M92906</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to combine column 'Seq' and 'lab_mom' together.&amp;nbsp; Please advice how to do it.&amp;nbsp;&amp;nbsp; Also, I think there is something wrong with my code cause the column 'lab_child' is not showing the data in SAS.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; data3;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;infile&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; datalines &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;dlm&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;','&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;dsd&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ID &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$4.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Seq &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;best8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; DOB &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;mmddyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lab_mom &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lab_child &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; dob &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;mmddyys10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ID Seq DOB lab_mom;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;A045, 1, 05/06/1979, NH,&lt;/P&gt;
&lt;P&gt;A045, 2, 05/06/1979, NH,&lt;/P&gt;
&lt;P&gt;A045, 1, 05/06/1979, ,NU&lt;/P&gt;
&lt;P&gt;B100, 1, 06/15/1982, JJ,&lt;/P&gt;
&lt;P&gt;B100, 2, 06/15/1982, JJ,&lt;/P&gt;
&lt;P&gt;B100, 1, 06/15/1982, ,PJ&lt;/P&gt;
&lt;P&gt;C300, 1, 05/06/1979, KK,&lt;/P&gt;
&lt;P&gt;C300, 2, 05/06/1979, KK,&lt;/P&gt;
&lt;P&gt;C300, 1, 05/06/1979, ,OL&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 19:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387468#M92906</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-08-11T19:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387472#M92907</link>
      <description>&lt;P&gt;Since you do not assign any value to Lab_child why to you expect to see one? there is nothing on the dataline to read for a fifth variable. The variable is in the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HOW do you want Seg and and Lab_mom combined?&lt;/P&gt;
&lt;P&gt;some possible ways:&lt;/P&gt;
&lt;P&gt;Combined= cats(seq,lab_mom);&lt;/P&gt;
&lt;P&gt;combined= cats(lab_mom,seq);&lt;/P&gt;
&lt;P&gt;combined= catx('_',lab_mom,seq);&lt;/P&gt;
&lt;P&gt;combined= catx('-',seq,lab_mom);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but you really should show what you would expect the combination to look like.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 19:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387472#M92907</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-11T19:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387473#M92908</link>
      <description>&lt;P&gt;Such like,&lt;/P&gt;
&lt;P&gt;1NH&lt;/P&gt;
&lt;P&gt;2NH&lt;/P&gt;
&lt;P&gt;1NU&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 19:31:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387473#M92908</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-08-11T19:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387478#M92909</link>
      <description>&lt;P&gt;Hi, Ballardw:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is not working.&amp;nbsp; The result only show numeric number, such as '1.'.&amp;nbsp;&amp;nbsp; But no charater is appending behind.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 19:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387478#M92909</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-08-11T19:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387482#M92911</link>
      <description>&lt;PRE&gt;data data3;
infile datalines dlm=',' dsd; 
informat ID $4. Seq best8. DOB mmddyy10. lab_mom $8. lab_child $8.;
format dob mmddyys10.;
input ID Seq DOB lab_mom;
Combined1= cats(seq,lab_mom);
combined2= cats(lab_mom,seq);
combined3= catx('_',lab_mom,seq);
combined4= catx('-',seq,lab_mom);

datalines;
A045, 1, 05/06/1979, NH,
A045, 2, 05/06/1979, NH,
A045, 1, 05/06/1979, ,NU
B100, 1, 06/15/1982, JJ,
B100, 2, 06/15/1982, JJ,
B100, 1, 06/15/1982, ,PJ
C300, 1, 05/06/1979, KK,
C300, 2, 05/06/1979, KK,
C300, 1, 05/06/1979, ,OL
;


proc print data=data3 noobs;
run;&lt;/PRE&gt;
&lt;P&gt;Your result of 1 is when the is no value for lab_mon. NOTE that you have an extra comma in&amp;nbsp;3 of your data lines statements in the third, sixth and ninth&amp;nbsp;lines. GIGO.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this combined is supposed to be the lab_child then you should say so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And saying the code doesn't work without showing what exact code you ran is pretty difficult to tell which code you mean.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 22:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387482#M92911</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-11T22:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387488#M92912</link>
      <description>&lt;P&gt;So, both Cats and Catx work in the numeric and charateric variables?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 20:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387488#M92912</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-08-11T20:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387492#M92913</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;So, both Cats and Catx work in the numeric and charateric variables?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Try it. Look at the results and log afterwards, and learn.&lt;BR /&gt;See Maxim 4.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 20:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387492#M92913</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-11T20:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387964#M93051</link>
      <description>&lt;P&gt;Thank you so much for your great help!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 20:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-two-columns/m-p/387964#M93051</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-08-14T20:35:13Z</dc:date>
    </item>
  </channel>
</rss>

