<?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: Proc Compare to get output data set in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57292#M15983</link>
    <description>Hi Scoot,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help..with your help I get this one:&lt;BR /&gt;
&lt;BR /&gt;
data A;&lt;BR /&gt;
input id name $ age score1 score2 score3;&lt;BR /&gt;
cards;&lt;BR /&gt;
&lt;BR /&gt;
222 robert 42 258 239 360 &lt;BR /&gt;
333 rob 28 308 246 218 &lt;BR /&gt;
444 gary 35 234 289 290 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
data B;&lt;BR /&gt;
input id name $ age score1 score2 score3  ;&lt;BR /&gt;
cards;&lt;BR /&gt;
&lt;BR /&gt;
222 robert 40 258 225 356 222&lt;BR /&gt;
333 rob 28 301 246 218 &lt;BR /&gt;
444 gary 34 234 289 256 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc compare data=A&lt;BR /&gt;
compare=B&lt;BR /&gt;
outnoequal&lt;BR /&gt;
out=C&lt;BR /&gt;
noprint&lt;BR /&gt;
outcomp&lt;BR /&gt;
outbase;&lt;BR /&gt;
id &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
OUTOUT:&lt;BR /&gt;
&lt;BR /&gt;
_TYPE_	_OBS_	id	name	age	score1	score2	score3&lt;BR /&gt;
BASE	2	222	robert	42	258	239	360&lt;BR /&gt;
COMPARE	2	222	robert	40	258	225	356&lt;BR /&gt;
BASE	3	333	rob	28	308	246	218&lt;BR /&gt;
COMPARE	3	333	rob	28	301	246	218&lt;BR /&gt;
BASE	4	444	gary	35	234	289	290&lt;BR /&gt;
COMPARE	4	444	gary	34	234	289	256&lt;BR /&gt;
&lt;BR /&gt;
But still I want to compare data set A with data set B and if both values are same then I want missing/blank on that place of observation and if it's different then I want value of data set A by ID...will appreciate if any help...&lt;BR /&gt;
&lt;BR /&gt;
Thanks....</description>
    <pubDate>Mon, 03 Jan 2011 00:28:02 GMT</pubDate>
    <dc:creator>tom16</dc:creator>
    <dc:date>2011-01-03T00:28:02Z</dc:date>
    <item>
      <title>Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57290#M15981</link>
      <description>data A&lt;BR /&gt;
id   name   age  score1 score2 score3 score4&lt;BR /&gt;
111   tom    30    230    240     260      .&lt;BR /&gt;
222   robert 42    258    239     360      .&lt;BR /&gt;
333   rob    28    308    246     218       .&lt;BR /&gt;
444   gary   35    234    289     290      .&lt;BR /&gt;
&lt;BR /&gt;
data B&lt;BR /&gt;
id   name   age  score1 score2 score3 score4&lt;BR /&gt;
111   tom    30    230    240     260&lt;BR /&gt;
222   robert 40    258    225     356&lt;BR /&gt;
333   rob    28    301    246     218&lt;BR /&gt;
444   gary   34    234    289     256&lt;BR /&gt;
&lt;BR /&gt;
I want to use proc compare and want output like this:&lt;BR /&gt;
-&amp;gt; compare data A with data B and in output data set C&lt;BR /&gt;
want missing value when values are same in both data sets&lt;BR /&gt;
and wants values from data set A when values are different in&lt;BR /&gt;
data A and data B.&lt;BR /&gt;
&lt;BR /&gt;
Please give syntex and output if you can...&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance  for your help....&lt;BR /&gt;
&lt;B&gt;&lt;/B&gt;&lt;B&gt;&lt;/B&gt;</description>
      <pubDate>Sun, 02 Jan 2011 14:40:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57290#M15981</guid>
      <dc:creator>tom16</dc:creator>
      <dc:date>2011-01-02T14:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57291#M15982</link>
      <description>Recommend starting with the available DOC and other technical papers available at SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website.&lt;BR /&gt;
&lt;BR /&gt;
PROC COMPARE has a NOPRINT feature, as documented, along with an output dataset.  You can generate the output, analyze it for content, and create a suitable report with either PROC PRINT, a DATA step directly, or PROC REPORT.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
proc compare output dataset analysis site:sas.com</description>
      <pubDate>Sun, 02 Jan 2011 15:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57291#M15982</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-01-02T15:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57292#M15983</link>
      <description>Hi Scoot,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help..with your help I get this one:&lt;BR /&gt;
&lt;BR /&gt;
data A;&lt;BR /&gt;
input id name $ age score1 score2 score3;&lt;BR /&gt;
cards;&lt;BR /&gt;
&lt;BR /&gt;
222 robert 42 258 239 360 &lt;BR /&gt;
333 rob 28 308 246 218 &lt;BR /&gt;
444 gary 35 234 289 290 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
data B;&lt;BR /&gt;
input id name $ age score1 score2 score3  ;&lt;BR /&gt;
cards;&lt;BR /&gt;
&lt;BR /&gt;
222 robert 40 258 225 356 222&lt;BR /&gt;
333 rob 28 301 246 218 &lt;BR /&gt;
444 gary 34 234 289 256 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc compare data=A&lt;BR /&gt;
compare=B&lt;BR /&gt;
outnoequal&lt;BR /&gt;
out=C&lt;BR /&gt;
noprint&lt;BR /&gt;
outcomp&lt;BR /&gt;
outbase;&lt;BR /&gt;
id &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
OUTOUT:&lt;BR /&gt;
&lt;BR /&gt;
_TYPE_	_OBS_	id	name	age	score1	score2	score3&lt;BR /&gt;
BASE	2	222	robert	42	258	239	360&lt;BR /&gt;
COMPARE	2	222	robert	40	258	225	356&lt;BR /&gt;
BASE	3	333	rob	28	308	246	218&lt;BR /&gt;
COMPARE	3	333	rob	28	301	246	218&lt;BR /&gt;
BASE	4	444	gary	35	234	289	290&lt;BR /&gt;
COMPARE	4	444	gary	34	234	289	256&lt;BR /&gt;
&lt;BR /&gt;
But still I want to compare data set A with data set B and if both values are same then I want missing/blank on that place of observation and if it's different then I want value of data set A by ID...will appreciate if any help...&lt;BR /&gt;
&lt;BR /&gt;
Thanks....</description>
      <pubDate>Mon, 03 Jan 2011 00:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57292#M15983</guid>
      <dc:creator>tom16</dc:creator>
      <dc:date>2011-01-03T00:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57293#M15984</link>
      <description>Tom,&lt;BR /&gt;
&lt;BR /&gt;
Since you want something other than what proc compare provides, why don't you just roll your own compare with a datastep?  E.g., I think that the following comes close to your specs:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data want (drop=i b_:);&lt;BR /&gt;
  merge a b (rename=(age=b_age score1-score3=b_score1-b_score3));&lt;BR /&gt;
  by id name;&lt;BR /&gt;
  array a_data(*) age score1-score3;&lt;BR /&gt;
  array b_data(*) b_age b_score1-b_score3;&lt;BR /&gt;
  do i=1 to dim(a_data);&lt;BR /&gt;
    if a_data(i) eq b_data(i) then call missing(a_data(i));&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Art</description>
      <pubDate>Mon, 03 Jan 2011 05:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57293#M15984</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-01-03T05:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57294#M15985</link>
      <description>Thanks for your answers...&lt;BR /&gt;
it work nice...&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 04 Jan 2011 01:14:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57294#M15985</guid>
      <dc:creator>tom16</dc:creator>
      <dc:date>2011-01-04T01:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57295#M15986</link>
      <description>When you remove the demand for PROC COMPARE (or whatever) solutions, simpler alternatives might be offered. &lt;BR /&gt;
As Art has recommended DATA STEP I will draw attention to PROC SQL and it's set operator EXCEPT. It makes this request seem almost trivial&lt;BR /&gt;
PROC SQL ; &lt;BR /&gt;
Create table differences as select * from A except select * from B;&lt;BR /&gt;
Quit;&lt;BR /&gt;
 &lt;BR /&gt;
Of course this is a row rather than individual column compare, but still worth considering. &lt;BR /&gt;
IMHO&lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
      <pubDate>Wed, 05 Jan 2011 09:26:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57295#M15986</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-01-05T09:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57296#M15987</link>
      <description>Hi.Peter.&lt;BR /&gt;
Maybe you misunderstood op's mean.op want missing when both are same.&lt;BR /&gt;
your sql code is only except the obs in B from A and they both have the same variables.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 06 Jan 2011 03:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57296#M15987</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-01-06T03:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57297#M15988</link>
      <description>kSharp&lt;BR /&gt;
Thank you&lt;BR /&gt;
 that might paraphrase my last sentence. &lt;BR /&gt;
I was surprised and  did not expect to provide a row on output which held only missing values. &lt;BR /&gt;
So did not think the original posted question entirely clear. However, I thought that SQL form of compare would be worth reviewing. Don't you agree?&lt;BR /&gt;
&lt;BR /&gt;
peterC</description>
      <pubDate>Thu, 06 Jan 2011 09:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57297#M15988</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-01-06T09:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare to get output data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57298#M15989</link>
      <description>Agree!.&lt;BR /&gt;
Each of Data-step and Proc-sql has its virtues respectively,then If have skill of both ,you &lt;BR /&gt;
will be a perfect SAS programmer.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 07 Jan 2011 02:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Compare-to-get-output-data-set/m-p/57298#M15989</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-01-07T02:36:54Z</dc:date>
    </item>
  </channel>
</rss>

