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

There is a river notoriously known for it?s large crocodile population. With ease, how do you safely cross it?

1 Answers   Oracle,


I need level 2 to 5 sas using companies in india

0 Answers  


If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variable?

10 Answers   Accenture,


What are the different types of sas functions?

0 Answers  


How to create an external dataset with sas code?

0 Answers  






Describe the types of SAS programming tasks that you performed like Tables? Listings? Graphics? Ad hoc reports? Other?

4 Answers   HP, Oracle,


How would you remove a format that has been permanently associated with a variable? ________________

5 Answers   Quintiles, TCS,


How to read the file names of a text files from a shared drive using SAS?

1 Answers   HSBC, WNS,


how can u convert this 25-jul-2010 from numeric to charcter?

3 Answers  


How to limit decimal places for the variable using proc means?

0 Answers  


What is the sas data set? : sas-grid-administration

0 Answers  


What is the difference between the proc sql and data step?

0 Answers  


Categories