BookmarkSubscribeRSS Feed
sam369
Obsidian | Level 7


Hi Community,

i have a situation ,like i am comparing the pervious database to new database.

For exapmple . AE dataset. we collected Ae dataset in 2011 and 2012. I am comparing both datasets.

i need to show the newly added records. difference between old and new. I am using this code

proc compare base = ae

             compare = aenew

             out = difs

             OUTNOEQUAL LISTEQUALVAR LISTCOMPVAR LISTBASEVAR

             MAXPRINT=300

             ;

  id usubjid;

run;

in new data(2012) one or more usubjid have extra records. How to display new reocord and how to display the variable having different values

Thanks

Sam

1 REPLY 1
sassharp
Calcite | Level 5

https://communities.sas.com/thread/33633 I am sure this would help. Proc compare compares each column from table 1 to table 2 in a row. For example if there is a rundate in table1 and rundate in table2 need not be same even you started to run the code same time to get table1 and table2. For comparing two tables I am sure this is going to be usefulcode. /* first outer join table1 and table2*/ Proc SQL; Create table table1andtable2outerjoin as Select a.id as id_1, a.name as name_1, b.id as id_2, b.name as name_2 From table1 as a   Full Outer Join   table2 as b   on a.id = b.id and     a.name=b.name;   Quit; /*to see rows only in table2 not in table1 you can add more columns for comparison*/   Data tablenew;   Source = 'two';   Length Source $5;   Set table1andtable2outerjoin ;   if missing(id_1) and missing(name_1) then output;   Format Source $5.;   Informat Source $5.;       run; /*to see rows only in table1not in table2 you can add more columns for comparison*/ Data tableold; Source = 'one';   Length Source $5;   Set table1andtable2outerjoin;   if missing(id_2) and missing(name_2)  then output;     Format Source $5.;   Informat Source $5.;   run; /*to see rows side by side*/   Data tablenewold;   Set tablenew tableold;   run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 763 views
  • 0 likes
  • 2 in conversation