data data1;
input dt account;
format dt date9.;
cards;
1745 1230
1756 1120
1788 1130
1767 1240
;

data data2;
input startdt enddt total;
format startdt date9. enddt date9.;
cards;
1657 1834 12300
1557 1758 16800
1789 1789 12300
1788 1345 12383
1899 1899 13250
;

proc sql;
create table data3 as
select * from data1 as x left join data2 as y
on x.dt>=y.startdt and x.dt<=y.enddt;
quit;

Here, we are getting cartision product. But,I want left
join report consisting of this program. It should not get
duplicate values. you can modify the program also.

Answer Posted / aravind rangaraj

if u result look like as follows,its correct result only..
just chk d info observation by observation..
each date in data1 is satisfied..u r confused????
if any output u hav expected just write the output..

output:

dt account startdt enddt total
11OCT1964 1230 15JUL1964 08JAN1965 12300
22OCT1964 1120 15JUL1964 08JAN1965 12300
23NOV1964 1130 15JUL1964 08JAN1965 12300
02NOV1964 1240 15JUL1964 08JAN1965 12300
11OCT1964 1230 06APR1964 24OCT1964 16800
22OCT1964 1120 06APR1964 24OCT1964 16800

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you know about symput and symget?

727


What is maximum storage capability of SAS?

904


if a variable contain dates like "2015/01"---"2015/12" (yymm) ,How to add day to those dates,if them month is jan then 31 if the month is feb then 28 so on ...

940


Enlist the syntax rules followed in sas statements.

611


what is the use of proc sql? : Sas programming

592






How we can create SAS USER DEFINED CODE?

1609


What are the special input delimiters used in SAS?

653


how to create the AE dataset by using SDTMIG specifications and SAP plan by using UNIX platform?

2290


what is the function of catx syntax? : Sas-administrator

644


What are the statements that are executed only?

672


what can you learn from the sas log when debugging? : Sas programming

607


Can you explain the process of calendar?

640


what is metadata? : Sas-bi

598


How will you use the WHO Drug Dictionary for Reporting Clinical Trials?

1880


Differentiate between sas functions and sas procedures.

640