I am working with two sas datasets.
Dataset 1) sas dataset 2 is available
Dataset 2) Pulled data from sql database and dumped info into sas dataset
Dataset 1- has variable date1 Format date9.
Dataset 2- When in sql has format date(10) not null, but converts to $10. format when it converts to sas
I have a doubt in this:-
Trying to do a proc sql and joining both dates:-
Date 1=Date 2 but throws an error.
is this correct?
proc sql;
JOINS *******
where
date 1=input(date2,mmddyy10.)
I am getting a null dataset for some reason.. Pls help. Thanks
How does date2 value look like?
Not sure how date2 looks like but based on your syntax, why there is a space in date1
date 1=input(date2,mmddyy10.)
Make sure the structure of the text string in variable date2 is conform the informat used on the input statement in the where-clause...
data dataset1;
input date1 date9. person1 $10.;
format date1 date9.;
put date1 mmddyy10.;
cards;
05OCT1995 JONAS
;
run;
data dataset2;
input date2 $10. person2 $10.;
format date2 $10.;
cards;
10/05/1995 LAURA
;
run;
proc sql;
create table joined as
select * from dataset1 , dataset2
where date1 = input(date2, mmddyy10.)
;
run;
quit;
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.
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.