<?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: Use match-merge or proc sql to combine datasets and conditionally create variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110670#M258910</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How About..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data checkListMerge;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge table1(in=a) table2(in=b) table3(in=c);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if a then Table1='X';&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if b then Table2='X';&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if c then Table3='X';&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Feb 2013 14:27:18 GMT</pubDate>
    <dc:creator>kuridisanjeev</dc:creator>
    <dc:date>2013-02-15T14:27:18Z</dc:date>
    <item>
      <title>Use match-merge or proc sql to combine datasets and conditionally create variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110669#M258909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a number of datasets with common and unique variables. I want to create a master list of all the variables and add columns that indicate which datasets have which variables. I figured out a way to do this with proc sql and an outer join (see below) but it only really works with 2 tables. It appears a match-merge approach with a datastep is the way to go but I'm not sure how to add the checklist columns. Any suggestions? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;data work.table1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input name $ desc $;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;
&lt;P&gt;a descA&lt;/P&gt;
&lt;P&gt;b descB&lt;/P&gt;
&lt;P&gt;c descC&lt;/P&gt;
&lt;P&gt;d descD&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data work.table2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input name $ desc $;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;
&lt;P&gt;b descB&lt;/P&gt;
&lt;P&gt;d descD&lt;/P&gt;
&lt;P&gt;e descE&lt;/P&gt;
&lt;P&gt;f descF&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data work.table3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input name $ desc $;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;
&lt;P&gt;b descB&lt;/P&gt;
&lt;P&gt;c descC&lt;/P&gt;
&lt;P&gt;f descF&lt;/P&gt;
&lt;P&gt;g descG&lt;/P&gt;
&lt;P&gt;h descH&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;* this produces what I want but only works for 2 tables;&lt;/P&gt;
&lt;P&gt;* merge the files and add a checklist column for tables 1 and 2;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATE TABLE checkListSQL AS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN a.name = b.name THEN a.name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN a.name = '' THEN b.name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN b.name = '' THEN a.name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE 'NULL'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS Variable length = 10,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN a.name ~= '' then a.Desc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE b.DESC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END as Description length = 50,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN a.name = b.name THEN 'X'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN a.name ~= '' THEN 'X'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE ''&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END as table1 length = 10,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN b.name = a.name THEN 'X'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN b.name ~= '' THEN 'X'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE ''&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END as table2 length =10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM table1 as a &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FULL JOIN table2 as b&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ON a.name = b.name;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data checkListMerge;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge table1 table2 table3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name; *data already sorted;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *How to add the checklist portion via a data step?;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 14:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110669#M258909</guid>
      <dc:creator>kbk</dc:creator>
      <dc:date>2013-02-15T14:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Use match-merge or proc sql to combine datasets and conditionally create variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110670#M258910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How About..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data checkListMerge;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge table1(in=a) table2(in=b) table3(in=c);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if a then Table1='X';&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if b then Table2='X';&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if c then Table3='X';&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 14:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110670#M258910</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-02-15T14:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Use match-merge or proc sql to combine datasets and conditionally create variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110671#M258911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's almost too easy. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saw code similar to this while I was googling the problem but the syntax was so brief I couldn't understand the logic. Could I bother you for a layperson's explanation?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 14:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110671#M258911</guid>
      <dc:creator>kbk</dc:creator>
      <dc:date>2013-02-15T14:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Use match-merge or proc sql to combine datasets and conditionally create variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110672#M258912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hi..&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;For your understanding i modified the code..&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;data checkListMerge;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge table1(in=a) table2(in=b) table3(in=c);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name;&lt;/P&gt;&lt;P&gt;&amp;nbsp; a1=a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; b1=b;&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1=c;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;suppose If the value of A1 variable is 1 ,it means BY variable value(in your code BY variable is Name) is Exist in Table1,if&amp;nbsp; A1 value is 0 ,which means &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; BY variable value&lt;/SPAN&gt; not present in Table1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;For Example Name 'e' is present in only Table2.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;So that is what for&amp;nbsp; 'e' name,b1 value is 1 and A1,C1values are 0('e' not exist in Table1 and Table3)..&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Hope You understand the logic.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Regards.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Sanjeev.K &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: sajeev kuridi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 14:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110672#M258912</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-02-15T14:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Use match-merge or proc sql to combine datasets and conditionally create variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110673#M258913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again. I'll just add this text from &lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a002645476.htm"&gt;a sas help page&lt;/A&gt;.&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;TABLE cellpadding="0" cellspacing="0" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: arial,'Arial Unicode MS',geneva,'Lucida Grande',sans-serif; text-align: left; color: rgb(0, 0, 0); text-indent: 0px; background-color: rgb(255, 255, 255); width: 100%;"&gt;
&lt;TBODY style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;
&lt;TR style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;" valign="bottom"&gt;
&lt;TD style="color: #000000;"&gt;&lt;HR style="color: #cccccc; margin-top: 2.5em;" /&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;" valign="top"&gt;
&lt;TD class="title2" style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-weight: bold; font-size: 16px; margin-top: 1.4em;"&gt;&lt;A name="a001401089" style="font-weight: bold; font-style: normal; font-size: 16px; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; text-align: left; color: #000000;"&gt;&lt;/A&gt;Understanding the IN= Data Set Option&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P style="margin: 1.4em 0px 0px; font-weight: normal; font-style: normal; font-size: 13px; font-family: arial,'Arial Unicode MS',geneva,'Lucida Grande',sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;&lt;A name="a002074568" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;&lt;/A&gt;When you create a new data set by combining observations from two or more data sets, knowing which data set an observation came from can be useful. For example, you might want to perform a calculation based on which data set contributed an observation. Otherwise, you might lose important contextual information that you need for later processing. You can determine which data set contributed a particular observation by using the IN= data set option.&lt;/P&gt;
&lt;P style="margin: 1.4em 0px 0px; font-weight: normal; font-style: normal; font-size: 13px; font-family: arial,'Arial Unicode MS',geneva,'Lucida Grande',sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;&lt;A name="a002074569" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;&lt;/A&gt;The IN= data set option enables you to determine which data sets have contributed to the observation that is currently in the program data vector. The syntax for this option on the SET statement is&lt;/P&gt;
&lt;P style="margin: 1.4em 0px 0px; font-weight: normal; font-style: normal; font-size: 13px; font-family: arial,'Arial Unicode MS',geneva,'Lucida Grande',sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;&lt;A name="a002645477" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;TABLE cellpadding="4" cellspacing="2" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;
&lt;TBODY style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;
&lt;TR style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;" valign="top"&gt;
&lt;TD style="color: #000000;"&gt;SET&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic;"&gt;SAS-data-set-1&lt;/SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;(IN=&lt;SPAN class="emph" style="font-style: italic;"&gt;variable&lt;/SPAN&gt;)&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic;"&gt;SAS-data-set-2&lt;/SPAN&gt;;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;TABLE cellpadding="4" cellspacing="2" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;
&lt;TBODY style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;
&lt;TR style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;" valign="top"&gt;
&lt;TD style="color: #000000;"&gt;BY&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic;"&gt;a-common-variable&lt;/SPAN&gt;;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P style="margin: 1.4em 0px 0px; font-weight: normal; font-style: normal; font-size: 13px; font-family: arial,'Arial Unicode MS',geneva,'Lucida Grande',sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;&lt;A name="a002074570" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;&lt;/A&gt;When you use the IN= option with a data set in a SET, MERGE, MODIFY, or UPDATE statement, SAS creates a temporary&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic;"&gt;variable&lt;/SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;associated with that data set. The value of&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;SPAN class="emph" style="font-style: italic;"&gt;variable&lt;/SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;is 1 if the data set has contributed to the observation currently in the program data vector. The value is 0 if it has not contributed. You can use the IN= option with any or all the data sets you name in a SET, MERGE, MODIFY, or UPDATE statement, but use a different variable name in each case.&lt;/P&gt;
&lt;P style="margin: 1.4em 0px 0px; font-weight: normal; font-style: normal; font-size: 13px; font-family: arial,'Arial Unicode MS',geneva,'Lucida Grande',sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;&lt;SPAN class="strong" style="font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-weight: bold; color: #000000;"&gt;Note:&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; The IN= variable exists during the execution of the DATA step only; it is not written to the output data set that is created. &lt;/P&gt;
&lt;P&gt;&lt;A name="a002074571" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;TABLE cellpadding="0" cellspacing="0" style="font-weight: normal; font-style: normal; font-size: 13px; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; text-align: left; color: #000000; text-indent: 0px; background-color: #ffffff;" width="100%"&gt;
&lt;TBODY style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;"&gt;
&lt;TR style="font-weight: normal; font-style: normal; font-size: 13px; font-family: inherit; text-align: left;" valign="bottom"&gt;&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 15:15:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110673#M258913</guid>
      <dc:creator>kbk</dc:creator>
      <dc:date>2013-02-15T15:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use match-merge or proc sql to combine datasets and conditionally create variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110674#M258914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yup..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also Perform All Types of joins in datastep with IN= options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more info..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.nesug.org/Proceedings/nesug11/ds/ds03.pdf" title="http://www.nesug.org/Proceedings/nesug11/ds/ds03.pdf"&gt;http://www.nesug.org/Proceedings/nesug11/ds/ds03.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 15:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110674#M258914</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-02-15T15:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use match-merge or proc sql to combine datasets and conditionally create variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110675#M258915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found this one also..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi30/249-30.pdf" title="http://www2.sas.com/proceedings/sugi30/249-30.pdf"&gt;http://www2.sas.com/proceedings/sugi30/249-30.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds.&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 15:21:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-match-merge-or-proc-sql-to-combine-datasets-and/m-p/110675#M258915</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-02-15T15:21:37Z</dc:date>
    </item>
  </channel>
</rss>

