Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How would you code a merge that will write the matches of
both to one data set, the non-matches from the left-most
data set to a second data set, and the non-matches of the
right-most data set to a third data set?

Answers were Sorted based on User's Feedback



How would you code a merge that will write the matches of both to one data set, the non-matches fro..

Answer / sas job searcher

data x1y1
x1y0
x0y1;
/* x1y1, x1y0, x0y1 are output data set names */
merge left_most(in=x) right_most(in=y);
by id;
/* write all matches to x1y1: */
if x=1 and y=1 then output x1y1;
/* non-matches from the left-most data set: */
if x=1 and y=0 then output x1y0;
/* non-matches from the right-most data set: */
if x=0 and y=1 then output x0y1;
run;

Is This Answer Correct ?    11 Yes 1 No

How would you code a merge that will write the matches of both to one data set, the non-matches fro..

Answer / reddy

data both left_only right_only;
merge dataset1(in=a) dataset2(in=b);
by variable;
if a and b then output both;
if a and not b then output left_only;
if b and not a then output right_only;
run;

i think these is the easy way of writing the code,if any
one nows other please specify.thanks!

Is This Answer Correct ?    11 Yes 4 No

Post New Answer

More SAS Interview Questions

Please write codes to merge two datasets and keep every record in the first dataset.

1 Answers  


Do you use PROC REPORT or PROC TABULATE? Which do you prefer? Explain.

3 Answers  


What is the use of function Proc summary?

0 Answers  


how would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? : Sas programming

0 Answers  


what is the difference between x=substr(name,1,2); and substr(name,1,2)='x';

3 Answers   HSBC,


what are the scrubbing procedures in sas? : Sas programming

0 Answers  


How can I remove header from output data set?

0 Answers  


Why and when do you use proc sql?

0 Answers  


Hi, I have one dataset like id date ex: id date 1 13 1 13Oct2011 2 14 2 14Oct2011 3 15 3 15Oct2011 --->this is the current date here i want date format like 13Oct2011,14Oct2011 how we can modify the numeric to date format plz answer.

4 Answers  


How do you write a test plan?

1 Answers   Oracle,


In which format does Date stores in sas..? What is the use of DATE in SAS.?

3 Answers   TCS,


How to create an external dataset with sas code?

0 Answers  


Categories