<?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 variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148517#M29354</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also simply use this code for char variables......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT(DROP=F1 F2);&lt;/P&gt;&lt;P&gt; SET HAVE;&lt;/P&gt;&lt;P&gt; IF B1 EQ ' ' AND F1 NE ' ' THEN B1 = F1;&lt;/P&gt;&lt;P&gt; IF B2 EQ ' ' AND F2 NE ' ' THEN B2 = F2;&lt;/P&gt;&lt;P&gt; RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Oct 2014 06:24:06 GMT</pubDate>
    <dc:creator>RaviKommuri</dc:creator>
    <dc:date>2014-10-30T06:24:06Z</dc:date>
    <item>
      <title>How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148512#M29349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Dear All,&lt;/P&gt;&lt;P&gt;Here is my data file:&lt;/P&gt;&lt;P&gt;ID type b1 b2 f1 f2&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 5 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable b1 and b2 are baseline variables.&lt;/P&gt;&lt;P&gt;f1 and f2 are follow up variables. b1 and f1 are same.&lt;/P&gt;&lt;P&gt;b2 and f2 are same. Is there a way to combine these 2 same variables into 1 variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 20:37:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148512#M29349</guid>
      <dc:creator>xinjian</dc:creator>
      <dc:date>2014-10-29T20:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148513#M29350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lots of ways but whether they're what you want ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Provide an example of what the final output should look like for your example data.&lt;/P&gt;&lt;P&gt;You say b1 and f1, and b2 and f2, are the same but I don't see any that show that behavior in your example.&lt;/P&gt;&lt;P&gt;I see b1=5 and f2=5 but none with b1=f1.&lt;/P&gt;&lt;P&gt;And what role do ID and Type play in this request?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 22:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148513#M29350</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-29T22:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148514#M29351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ballardw,&lt;/P&gt;&lt;P&gt;Thanks for helping me. b1 and fi are same king of variable, b2 and f2 also same kind of variable. Type is like time variable, type=a means baseline test. type= b or c mean follow up test. ID is to identify subject. I want know difference between baseline and follow up. the final data file should like this:&lt;/P&gt;&lt;P&gt;ID type b1 b2 &lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 23:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148514#M29351</guid>
      <dc:creator>xinjian</dc:creator>
      <dc:date>2014-10-29T23:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148515#M29352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want (drop=f1 f2);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;b1=coalesce(b1,f1);&lt;/P&gt;&lt;P&gt;b2=coalesce(b2,f2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 00:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148515#M29352</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-10-30T00:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148516#M29353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;I use coalesce function to combine numeric variables done well. doesn't work for char variables. log file showed 'NOTE': invalid numeric data,. for that char variable. Is there a way to combine char variables?&lt;/P&gt;&lt;P&gt;Thanks so much,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 04:18:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148516#M29353</guid>
      <dc:creator>xinjian</dc:creator>
      <dc:date>2014-10-30T04:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148517#M29354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also simply use this code for char variables......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT(DROP=F1 F2);&lt;/P&gt;&lt;P&gt; SET HAVE;&lt;/P&gt;&lt;P&gt; IF B1 EQ ' ' AND F1 NE ' ' THEN B1 = F1;&lt;/P&gt;&lt;P&gt; IF B2 EQ ' ' AND F2 NE ' ' THEN B2 = F2;&lt;/P&gt;&lt;P&gt; RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 06:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148517#M29354</guid>
      <dc:creator>RaviKommuri</dc:creator>
      <dc:date>2014-10-30T06:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148518#M29355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;b1=coalesce&lt;STRONG&gt;c&lt;/STRONG&gt;(b1,f1);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 11:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148518#M29355</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-30T11:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148519#M29356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just for a completely different way, set the data together with a rename:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt; set have (drop=f1 f2 rename=(b1=f1 b2=f2) where=(type="a"))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have (where=(type ne "a") drop=b1 b2);&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 11:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148519#M29356</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-30T11:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148520#M29357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming id and type are unique :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;infile datalines&amp;nbsp; truncover;&lt;BR /&gt;input ID type $ b1&amp;nbsp; b2&amp;nbsp; f1 f2;&lt;BR /&gt;datalines;&lt;BR /&gt;1&amp;nbsp;&amp;nbsp; a 5&amp;nbsp; 6&lt;BR /&gt;1&amp;nbsp;&amp;nbsp; b . . 1&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;1&amp;nbsp;&amp;nbsp; c . . 2&amp;nbsp;&amp;nbsp; 5&lt;BR /&gt;2&amp;nbsp;&amp;nbsp; a 4&amp;nbsp; 3&lt;BR /&gt;2&amp;nbsp;&amp;nbsp; b . . 6&amp;nbsp;&amp;nbsp; 6&lt;BR /&gt;2&amp;nbsp;&amp;nbsp; c . . 3&amp;nbsp;&amp;nbsp; 5 &lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc sort data=have;&lt;/P&gt;&lt;P&gt;by id type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;update have have(drop=b1 b2 rename=(f1=b1 f2=b2));&lt;BR /&gt;by id type;&lt;/P&gt;&lt;P&gt;drop f1 f2;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 12:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148520#M29357</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2014-10-30T12:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148521#M29358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;RW9 and Keshan,&lt;/P&gt;&lt;P&gt;Thanks for your help. BOTH WAYS work well.&lt;/P&gt;&lt;P&gt;Just ask Keshan, coalescec&lt;STRONG&gt; function only works for char variables?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks,&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 15:59:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148521#M29358</guid>
      <dc:creator>xinjian</dc:creator>
      <dc:date>2014-10-30T15:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148522#M29359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am asking for coalescec.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 16:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148522#M29359</guid>
      <dc:creator>xinjian</dc:creator>
      <dc:date>2014-10-30T16:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148523#M29360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;coalescec is for Character , while &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;coalesce is for Numeric&lt;/SPAN&gt;&lt;STRONG style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2014 05:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148523#M29360</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-31T05:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to Combine two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148524#M29361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Keshan,&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2014 10:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Combine-two-variables/m-p/148524#M29361</guid>
      <dc:creator>xinjian</dc:creator>
      <dc:date>2014-10-31T10:50:11Z</dc:date>
    </item>
  </channel>
</rss>

