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.



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

Answer / 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

More SAS Interview Questions

Explain the message 'Merge has one or more datasets with repeats of by variables'.

5 Answers  


what other SAS features do you use for error trapping and data validation?

3 Answers   Quintiles,


how to rearrange the data as our wish by using dataset block?

4 Answers   Cognizant,


How experienced are you with customized reporting and use of Data _Null_ features?

4 Answers   Oracle,


how to add distinctly var variable values ex.. Data a; input var; datalines; 0 1 2 3 -1 -2 -3 ; run; adding all +ve value in one varibale n do the same for -ve too

5 Answers   CTS,






How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?

0 Answers   Accenture,


what is picture format? give any one example?

3 Answers   Parexel,


Why is a STOP statement needed for the point=option on a SET statement?

2 Answers   Quintiles,


do you prefer proc report or proc tabulate? Why? : Sas programming

0 Answers  


what is sas application server? : Sas-di

0 Answers  


What is SAS? What are the functions does it performs?

0 Answers  


What is the difference between input and infile statement?

0 Answers  


Categories