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 the difference between sas and other datawarehousing languages?what are the advantages of sas over them?

2 Answers   Accenture, Infosys,


Which is the best place to learn SAS clinicals and Oracle clinical in hyderabad?

2 Answers  


what is sas database server? : Sas-di

0 Answers  


How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas?

0 Answers  


How to save the log information in a file for future use

2 Answers   HCL,






How would you code the criteria to restrict the output to be produced?

9 Answers  


For what purpose(s) would use the RETURN statement?

1 Answers  


What would the following datastep do? Data _null_; Set Dist end=eof; Call Symput("xx"!!left(put(_n_,2.)),&dimension); If EOF then Call Symput('numrows',left(put(_n_,2.))); Run; dimension is a macro variable that is being passed here

2 Answers  


Hi Jeevan/Akshara I have tried to contact SASI Vats for latest Advanced SAS Programming Certification Dumps (A00-212) but have not got any response. I would highly and gratefully appreciate your assistance in this regard. If you guys have access to this, would you be kind enough to forward it to me ? I would abide by all the terms you have for this. Please, note my email id: upretigopi@yahoo.com Preti Sharma

0 Answers  


What do you feel about hardcoding?

3 Answers   Pfizer,


in ods is there any lib's

2 Answers   SAS,


For what purpose would you use the RETAIN statement?

0 Answers   Quintiles,


Categories