<?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: Reg: Compare for matching and non matching varaibles in two datsets. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70633#M20332</link>
    <description>a</description>
    <pubDate>Thu, 09 Sep 2010 05:02:18 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-09-09T05:02:18Z</dc:date>
    <item>
      <title>Reg: Compare for matching and non matching varaibles in two datsets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70630#M20329</link>
      <description>Hi&lt;BR /&gt;
i am having two datasets x and y in dataset x i am having variables a,b,c,d&lt;BR /&gt;
and in dataset y i am having variables a,b,s,d&lt;BR /&gt;
now i want to find out how many matching variables are there for both the dataset and not matching .If matching it should be outputed to new dataset,if not compared it should be outputed to anohter dataset.IF MATCHED THE DATASETS SHOULD BE APPENDED.</description>
      <pubDate>Wed, 08 Sep 2010 12:01:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70630#M20329</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-08T12:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: Compare for matching and non matching varaibles in two datsets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70631#M20330</link>
      <description>Just to make sure that I understand, you just want to determine whether the variable names match, not the data values right?  If this is correct, you should look into using sashelp.vcolumn.  Something like this:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data X_variables(keep=name);&lt;BR /&gt;
	set sashelp.vcolumn(where=(libname='WORK' and memname = 'X'));&lt;BR /&gt;
data Y_variables(keep=name);&lt;BR /&gt;
	set sashelp.vcolumn(where=(libname='WORK' and memname = 'Y'));&lt;BR /&gt;
proc sort data=X_variables; by name;&lt;BR /&gt;
proc sort data=Y_variables; by name;&lt;BR /&gt;
&lt;BR /&gt;
data matching nonmatching;&lt;BR /&gt;
	merge X_variables(in=inX) Y_variables(in=inY);&lt;BR /&gt;
	by name;&lt;BR /&gt;
	if inX and inY then output matching;&lt;BR /&gt;
	else output nonmatching;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 08 Sep 2010 13:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70631#M20330</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2010-09-08T13:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: Compare for matching and non matching varaibles in two datsets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70632#M20331</link>
      <description>Thanks for your query but in non matched dataset i wnat to find the variables from which dataset they are compning from x dataset or y dataset.i wnat like this sir&lt;BR /&gt;
&lt;BR /&gt;
data x;&lt;BR /&gt;
input a  b c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data y;&lt;BR /&gt;
input  a  b d e;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
matched: a b&lt;BR /&gt;
nonmatched :&lt;BR /&gt;
variables datasetset&lt;BR /&gt;
c               x&lt;BR /&gt;
d               y&lt;BR /&gt;
e               y</description>
      <pubDate>Thu, 09 Sep 2010 05:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70632#M20331</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-09T05:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: Compare for matching and non matching varaibles in two datsets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70633#M20332</link>
      <description>a</description>
      <pubDate>Thu, 09 Sep 2010 05:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70633#M20332</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-09T05:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: Compare for matching and non matching varaibles in two datsets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70634#M20333</link>
      <description>That can be done by keeping the memname variable from sashelp.vcolumn:&lt;BR /&gt;
&lt;BR /&gt;
data X_variables(keep=name memname);&lt;BR /&gt;
set sashelp.vcolumn(where=(libname='WORK' and memname = 'X'));&lt;BR /&gt;
data Y_variables(keep=name memname);&lt;BR /&gt;
set sashelp.vcolumn(where=(libname='WORK' and memname = 'Y'));&lt;BR /&gt;
proc sort data=X_variables; by name;&lt;BR /&gt;
proc sort data=Y_variables; by name;&lt;BR /&gt;
&lt;BR /&gt;
data matching(drop=memname) nonmatching;&lt;BR /&gt;
merge X_variables(in=inX) Y_variables(in=inY);&lt;BR /&gt;
by name;&lt;BR /&gt;
if inX and inY then output matching;&lt;BR /&gt;
else output nonmatching;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 09 Sep 2010 10:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70634#M20333</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2010-09-09T10:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reg: Compare for matching and non matching varaibles in two datsets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70635#M20334</link>
      <description>I would use PROC COMPARE for this. You can figure out how to make the output look like you want.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data x; input a b c f:$1. ; cards;&lt;BR /&gt;
   run;&lt;BR /&gt;
data y; input a b d e f; cards;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc compare base=x(obs=1) compare=y(obs=1) listvar novalues;&lt;BR /&gt;
   ods exclude CompareSummary;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 09 Sep 2010 14:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Compare-for-matching-and-non-matching-varaibles-in-two/m-p/70635#M20334</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-09-09T14:41:32Z</dc:date>
    </item>
  </channel>
</rss>

