When merging 2 datasets with a common variable (not merge
key), how to keep both?

Answers were Sorted based on User's Feedback



When merging 2 datasets with a common variable (not merge key), how to keep both?..

Answer / reshma

data newdata;
merge dataset1 (in=a) datset2 (in=b);
if a or b;
by commonvar;
run;

Is This Answer Correct ?    7 Yes 2 No

When merging 2 datasets with a common variable (not merge key), how to keep both?..

Answer / vigneshwaran.s

Rename the variable in First data or in The Second Data:

Like,

Merge A(rename=(comman_var=New_var))(in=x)
B (in=y);
by New_var;
Run;

Is This Answer Correct ?    4 Yes 0 No

When merging 2 datasets with a common variable (not merge key), how to keep both?..

Answer / madhavi.nowduru@gmail.com

set dataset1 dataset2;
by var;

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SAS Interview Questions

what is difference in window SAS & Unix SAS.....how do define working environment in both???

1 Answers   JPMorgan Chase,


How would you combine 3 or more tables with different structures?

7 Answers  


What is the SAS data set?

0 Answers  


What does the trace option do?

0 Answers  


what is the difference between DUPKEY and NODUPKEY???

4 Answers   Cognizant, EXL,


What type of tables you are using in YOUR reporting..???

2 Answers   GSK GlaxoSmithKline,


when we are using the PROC TRANSPOSE? OBSERVATIONS are repeated then what will happen and what it will show in log window.

1 Answers  


what is option year cuttoff in sas

2 Answers   L&T,


In proc transpose and data step with arrays which one you pick?

0 Answers   Accenture, Quintiles,


how to read the variables in sas? : Sas-administrator

0 Answers  


how are numeric and character missing values represented internally? : Sas programming

0 Answers  


Did you used proc test? when?

0 Answers   Accenture, Quintiles,


Categories