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;

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
  • 3 replies
  • 5316 views
  • 0 likes
  • 3 in conversation