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.

Answer Posted / arun & g.n.rao

data one;
input ID$ NAME$;
datalines;
A01 SUE
A02 TOM
A05 KAY
A10 JIM
;
RUN;
DATA TWO;
INPUT ID$ AGE SEX$;
DATALINES;
A01 58 F
A02 20 M
A04 47 F
A10 11 M
;
RUN;

DATA N1 N2 N3;
MERGE ONE (IN=X) TWO (IN=Y);
BY ID;
IF X=1 AND Y=1 THEN OUTPUT N1;
IF X=1 AND Y=0 THEN OUTPUT N2;
IF X=0 AND Y=1 THEN OUTPUT N3;
RUN;

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

describe about physical data integration? : Sas-di

569


Name and describe few sas character functions that are used for data cleaning in brief.

677


What are the different types of sas functions?

617


What do the sas log messages “numeric values have been converted to character” mean? What are the implications?

736


what is broad cast agent? : Sas-bi

609






For clinical entire study how many tables will create approx?

1530


How can I remove header from output data set?

2082


What does P-value signify about the statistical data?

862


Differentiate between ceil and floor functions.

670


how could you generate test data with no input data? : Sas programming

642


what is null hypothesis? why do you consider that?

2429


Can you execute macro within another macro? : sas-macro

541


What can be the size of largest dataset in SAS?

731


What are the advantages of using sas?

621


what is proc Index? and what is proc document?

2003