<?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 Comparing data of two datasets in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681617#M36940</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have one SAS code to write. I would be thankful if anyone of you could help me out!&lt;BR /&gt;&lt;BR /&gt;I have two datasets. Both have two variables - 'Name' and 'Type'. The Name variable has values like - April Provision, August Provision, BP etc. while 'Type' variable represents the datatype of these variables. If 'Type' has value 1 then it is 'Numeric' datatype and if 'Type ' has value 2 then it is 'Char' dataype.&lt;BR /&gt;'Name' variable is unique/primary key of the dataset. (The observations in the 'Name' column are same in both the datasets)&lt;BR /&gt;Problem - I need to compare these two datasets. So my first dataset is the baseline against which I will be comparing my second dataset. My SAS code should identify those variables for which the datatype has changed. That means it should look for variable names in the first dataset and then compare the datatypes of these variables with those in the second dataset. If there is a change in the datatype (i.e 'Type' column), it should print that variable name, it's old 'Type' (the one in the first dataset) and the new 'Type' (the one in the second dataset). Likewise, the code should check this for all the variables in the first dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output should also print the variable name along with it's datatype for those variables present in the second dataset but missing in the first dataset.&lt;BR /&gt;&lt;BR /&gt;How can I do this?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 04 Sep 2020 12:45:00 GMT</pubDate>
    <dc:creator>Kanica_V</dc:creator>
    <dc:date>2020-09-04T12:45:00Z</dc:date>
    <item>
      <title>Comparing data of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681617#M36940</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have one SAS code to write. I would be thankful if anyone of you could help me out!&lt;BR /&gt;&lt;BR /&gt;I have two datasets. Both have two variables - 'Name' and 'Type'. The Name variable has values like - April Provision, August Provision, BP etc. while 'Type' variable represents the datatype of these variables. If 'Type' has value 1 then it is 'Numeric' datatype and if 'Type ' has value 2 then it is 'Char' dataype.&lt;BR /&gt;'Name' variable is unique/primary key of the dataset. (The observations in the 'Name' column are same in both the datasets)&lt;BR /&gt;Problem - I need to compare these two datasets. So my first dataset is the baseline against which I will be comparing my second dataset. My SAS code should identify those variables for which the datatype has changed. That means it should look for variable names in the first dataset and then compare the datatypes of these variables with those in the second dataset. If there is a change in the datatype (i.e 'Type' column), it should print that variable name, it's old 'Type' (the one in the first dataset) and the new 'Type' (the one in the second dataset). Likewise, the code should check this for all the variables in the first dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output should also print the variable name along with it's datatype for those variables present in the second dataset but missing in the first dataset.&lt;BR /&gt;&lt;BR /&gt;How can I do this?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 12:45:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681617#M36940</guid>
      <dc:creator>Kanica_V</dc:creator>
      <dc:date>2020-09-04T12:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681624#M36941</link>
      <description>&lt;P&gt;Did you try using PROC COMPARE?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 13:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681624#M36941</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-04T13:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681855#M36942</link>
      <description>Yes. But I'm not getting the desired output.&lt;BR /&gt;My datasets are below -&lt;BR /&gt;Dataset 1 -&lt;BR /&gt;Name Type&lt;BR /&gt;August Provison 1&lt;BR /&gt;April Provision 1&lt;BR /&gt;BP 2&lt;BR /&gt;Date 1&lt;BR /&gt;&lt;BR /&gt;Dataset 2 -&lt;BR /&gt;Name Type&lt;BR /&gt;August Provison 1&lt;BR /&gt;April Provision 1&lt;BR /&gt;BP 1&lt;BR /&gt;Date 1&lt;BR /&gt;BP Key 1</description>
      <pubDate>Sun, 06 Sep 2020 08:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681855#M36942</guid>
      <dc:creator>Kanica_V</dc:creator>
      <dc:date>2020-09-06T08:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681860#M36943</link>
      <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds1;
infile datalines dlm="," dsd;
input name :$20. type;
datalines;
August Provison,1
April Provision,1
BP,2
Date,1
;

data ds2;
infile datalines dlm="," dsd;
input name :$20. type;
datalines;
August Provison,1
April Provision,1
BP,1
Date,1
BP Key,1
;

proc sort data=ds1;
by name;
run;

proc sort data=ds2;
by name;
run;

data compare;
merge
  ds1 (in=d1)
  ds2 (in=d2 rename=(type=type2))
;
by name;
nomatch = (d1 and d2 and type ne type2);
new = (d2 and not d1);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note how I presented input data in data steps with datalines, which makes it easy for us to recreate a dataset with a simple copy/paste and submit; please do so yourself in the future.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Sep 2020 10:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681860#M36943</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-06T10:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data of two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681933#M36946</link>
      <description>Sure will do. This worked. Thanks a lot!</description>
      <pubDate>Mon, 07 Sep 2020 01:23:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Comparing-data-of-two-datasets/m-p/681933#M36946</guid>
      <dc:creator>Kanica_V</dc:creator>
      <dc:date>2020-09-07T01:23:30Z</dc:date>
    </item>
  </channel>
</rss>

