<?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 tables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387298#M277307</link>
    <description>&lt;P&gt;You can't attach a character to seq, as it is a numeric variable. So you have to create a new variable of type character.&lt;/P&gt;
&lt;P&gt;Do a&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data combine;
set
  data1 (in=in1 rename=(lab_mom=lab))
  data2 (in=in2 rename=(lab_child=lab))
;
by ID;
length newseq $2 lab $8;
if in1 then newseq = put(seq,1.) !! 'M';
if in2 then newseq = put(seq,1.) !! 'C';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Edit: added the rename= dataset options.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2017 11:29:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-08-11T11:29:27Z</dc:date>
    <item>
      <title>How to combine tables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387297#M277306</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firest, I would like to combine the column lab_mom in data1 and the column lab_child in data2 in one column lab. &amp;nbsp;Second, I would like to assign M and C in the column Seq. &amp;nbsp;Last, could someone let me know why my data format is not right? &amp;nbsp;I could not get mm/dd/yyyy in the dataset. &amp;nbsp; Please advise how to do it. &amp;nbsp;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data data1;&lt;BR /&gt;informat ID $4. Seq best8. DOB mmddyy10. lab_mom $8. ;&lt;BR /&gt;input ID Seq DOB lab_mom;&lt;BR /&gt;cards;&lt;BR /&gt;A045 1 05/06/1979 NH &lt;BR /&gt;A045 2 05/06/1979 NH&lt;BR /&gt;B100 1 06/15/1982 JJ &lt;BR /&gt;B100 2 06/15/1982 JJ&lt;BR /&gt;C300 1 05/06/1979 KK&lt;BR /&gt;C300 2 05/06/1979 KK&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;data data2;&lt;BR /&gt;informat ID $4. Seq best8. DOB mmddyy10. lab_child $8. ;&lt;BR /&gt;input ID Seq DOB lab_child;&lt;BR /&gt;cards;&lt;BR /&gt;A045 1 05/06/1979 MJ &lt;BR /&gt;B100 1 06/15/1982 PL&lt;BR /&gt;C300 1 05/06/1979 OL&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;data combine;&lt;BR /&gt;informat ID $4. Seq best8. DOB mmddyy10. lab $8. ;&lt;BR /&gt;input ID Seq DOB lab;&lt;BR /&gt;cards;&lt;BR /&gt;A045 1M 05/06/1979 NH &lt;BR /&gt;A045 2M 05/06/1979 NH&lt;BR /&gt;A045 1C 05/06/1979 MJ &lt;BR /&gt;B100 1M 06/15/1982 JJ &lt;BR /&gt;B100 2M 06/15/1982 JJ&lt;BR /&gt;B100 1C 06/15/1982 PL&lt;BR /&gt;C300 1M 05/06/1979 KK&lt;BR /&gt;C300 2M 05/06/1979 KK&lt;BR /&gt;C300 1C 05/06/1979 OL&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 11:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387297#M277306</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-08-11T11:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine tables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387298#M277307</link>
      <description>&lt;P&gt;You can't attach a character to seq, as it is a numeric variable. So you have to create a new variable of type character.&lt;/P&gt;
&lt;P&gt;Do a&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data combine;
set
  data1 (in=in1 rename=(lab_mom=lab))
  data2 (in=in2 rename=(lab_child=lab))
;
by ID;
length newseq $2 lab $8;
if in1 then newseq = put(seq,1.) !! 'M';
if in2 then newseq = put(seq,1.) !! 'C';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Edit: added the rename= dataset options.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 11:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387298#M277307</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-11T11:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine tables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387304#M277308</link>
      <description>&lt;P&gt;Regarding the other half of your question ... reading in dates ... you are doing it properly. &amp;nbsp;It looks like the results are wrong, because the dates now contain a five-digit number. &amp;nbsp;To view the dates in a way that looks like a date, you have to assign a format. &amp;nbsp;Any of these are possible (as well as many more):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;format dob date9.;&lt;/P&gt;
&lt;P&gt;format dob yymmdd10.;&lt;/P&gt;
&lt;P&gt;format dob mmddyys10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to read a bit of the documentation on how SAS handles dates:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002200738.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002200738.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 12:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387304#M277308</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-11T12:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine tables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387308#M277309</link>
      <description>&lt;P&gt;Ups, missed the format question. In addition to what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; already said: assigning an informat does not automatically set a matching display format, this must be done in a separate statement.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 12:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387308#M277309</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-11T12:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine tables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387467#M277310</link>
      <description>&lt;P&gt;Thanks for everyone's great suggetion.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 19:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-tables/m-p/387467#M277310</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-08-11T19:09:12Z</dc:date>
    </item>
  </channel>
</rss>

