Help using Base SAS procedures

SAS date and input issue

Reply
Contributor
Posts: 27

SAS date and input issue

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

SAS Employee
Posts: 3

Re: SAS date and input issue

How does date2 value look like?

Trusted Advisor
Posts: 1,204

Re: SAS date and input issue

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

date 1=input(date2,mmddyy10.)

SAS Employee
Posts: 3

Re: SAS date and input issue

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;

Ask a Question
Discussion stats
  • 3 replies
  • 4714 views
  • 0 likes
  • 3 in conversation