BookmarkSubscribeRSS Feed
rakeshvvv
Quartz | Level 8

Dear All,

 

Can some one help me with below query. I have 1st dataset with three variables.

Id, date, term

 

 

I have second dataset with below three variables.

Term1,date1,id

For both the dataset ID is the primary key variable. I would like to write a query to output when TERM is not equal to TERM1. Term and Term1 will not be same sorting order for one to one match.

The output should look like this.

 

12004002 TRAMADOL UN/AUG/2014

12004002 MICONAZOL 18/JAN/2016

Thanks

Rakesh

5 REPLIES 5
ballardw
Super User

Which variables are in the output? Term, Term1, Date or date1 (assuming that ID is one of the output variables).

 

 

rakeshvvv
Quartz | Level 8
the variables present in the output should be id,term,term1,date

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Reeza
Super User

What about dates? Do those have to match or be within a window of each other?

ballardw
Super User

This may give what your are looking for if I understand the problem:

proc sql;
   create table want as
   select table1.id, table1.term,table1.date, table2.term1
   from table1 left join table2 
      on table1.id=table2.id
   where table1.term ne table2.term1;
quit;
LinusH
Tourmaline | Level 20
I'm confused. If ID is the PK then there should be no sort order for term..?
Data never sleeps

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 969 views
  • 0 likes
  • 4 in conversation