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 is the maximum length of the macro variable?

790


explain what is factor analysis? : Sas-administrator

689


what is ae onset date n what is RDS

2020


Explain what is SAS informats?

722


Can you execute macro within another macro? If so, how would sas know where the current macro ended and the new one began? : sas-macro

809






how many display types available in sas bi dashboard? : Sas-bi

725


explain about various caches available in data integrator? : Sas-di

676


what is sas enterprise intelligence architecture? : Sas-bi

639


how do you want missing values handled? : Sas programming

619


What is the difference between where and if statement?

718


what is business intelligence? : Sas-bi

678


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

1983


How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro

680


How do you test for missing values?

1157


what is the effect of the options statement errors=1? : Sas programming

687