how to write code for left outer join in SAs using datastep?

Answers were Sorted based on User's Feedback



how to write code for left outer join in SAs using datastep?..

Answer / uma

first sort these datasets by common variable DEPT_ID,Then
use the following:
data left_join;
merge emp (in=a) dept (in=b);
by dept_id;
if a then output;
run;

Is This Answer Correct ?    22 Yes 2 No

how to write code for left outer join in SAs using datastep?..

Answer / aniruddha

Data left_outer;
merge emp(in=a) dept(in=b);
by deptno;
if a=1 and b=0;
run;

Is This Answer Correct ?    22 Yes 8 No

how to write code for left outer join in SAs using datastep?..

Answer / lakshmi

data left_join;
merge data1(in=a) data2(in=b);
by subjid;
if a;
run;

Is This Answer Correct ?    10 Yes 3 No

how to write code for left outer join in SAs using datastep?..

Answer / jbhjhj

dnt use set it wnt work.
use merge with in statements as above.

Is This Answer Correct ?    8 Yes 6 No

how to write code for left outer join in SAs using datastep?..

Answer / venkatesh

if you use x=1 and y=0
you must use set statement also
try this
data a b;
merge one two;
by id;
if x=1 and y=1 then output a;
if x=1 and y=0 then output b;
data new;
set a b;
run;

Is This Answer Correct ?    1 Yes 0 No

how to write code for left outer join in SAs using datastep?..

Answer / raghava

proc sql;
select *
from one left join two
on one.X=two.X;
quit;

The above is code for lefjoin.

Is This Answer Correct ?    1 Yes 0 No

how to write code for left outer join in SAs using datastep?..

Answer / vk

Data Left_outer;
set data1(in=x) data2(in=y);
if x=0 and y=1;
run;

Is This Answer Correct ?    9 Yes 12 No

how to write code for left outer join in SAs using datastep?..

Answer / pnprasad

There is no such Inner & Left Joins. In SAS only one join
i.e Right Join. If you want Left Join you have to use the
data set in the second place. For example: D1 D2 are the
data sets for D2 you want to make, UPDATE D1 D2;

Is This Answer Correct ?    1 Yes 22 No

Post New Answer

More SAS Interview Questions

data task; input id date date9. visit; cards; 101 01jan2015 1 101 02jan2015 2 101 06jan2015 3 102 04jan2015 1 102 07jan2015 2 102 12jan2015 3 103 06jan2015 1 103 13jan2015 2 ; run; write a program to find out missing dates between visits by each subject.

1 Answers  


what is SAS/Access and SAS/Connect?what are the uses?

3 Answers  


Differentiate input and infile.

0 Answers  


tell me about use of arrays in sas

1 Answers   CoreEL,


what is Global Symbol table and Local symbol table?

4 Answers   CitiGroup,






What is Linear Regression?

0 Answers  


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

0 Answers  


how does sas handle missing values in formats? : Sas programming

0 Answers  


data study; input Subj : $3. Group : $1. Dose : $4. Weight : $8. Subgroup; x= input(Weight,5.1); datalines; 001 A Low 220 2 002 A High 90 1 003 B Low 193.6 1 004 B High 165 2 005 A Low 123.4 1 ; Why does X get truncated? X shows up as 22 instead of 220,9 instead of 90 and 19.8 instead of 198? This problem doesnt happen with the values 193.6 and 123.4. This does not happen if x is read on the 5. informat instead of the 5.1 informat

2 Answers  


In this question, I rename the numeric variable phone to numphone and then try use phone=put(numphone,comma16.) to store the numeric value numphone as a string value in phone. But I get a warning tha numphone already exists and in the data sat phone doesnt exist and numphone is set to missing. Why? data names_and_more; input Name $20. Phone : comma16. Height & $10. Mixed & $8.; Name = tranwrd(Name,' ',' '); rename phone = numphone; phone = put(numphone,comma16.); datalines; Roger Cody 9,087,821,234 5ft. 10in. 50 1/8 Thomas Jefferson 3,158,488,484 6ft. 1in. 23 1/2 Marco Polo 8,001,234,567 5Ft. 6in. 40 Brian Watson 5,183,551,766 5ft. 10in 89 3/4 Michael DeMarco 4,452,322,233 6ft. 76 1/3 ;

1 Answers  


What are the features of base sas system?

0 Answers  


what do the pad and dim functions do? : Sas programming

0 Answers  


Categories