BookmarkSubscribeRSS Feed
swathi123
Obsidian | Level 7

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

3 REPLIES 3
wimaerts
SAS Employee

How does date2 value look like?

stat_sas
Ammonite | Level 13

Not sure how date2 looks like but based on your syntax, why there is a space in date1

date 1=input(date2,mmddyy10.)

wimaerts
SAS Employee

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 5869 views
  • 0 likes
  • 3 in conversation