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

explain about sas business intelligence? : Sas-bi

0 Answers  


What are the analysis datasets created, and what are the new variables created in CLINICAL SAS

1 Answers   Accenture, Sciformix,


what is information maps?

0 Answers   CitiGroup,


what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming

0 Answers  


What are the Aggregate functions in SQL ?

2 Answers   AON,






what are all the ways to define macro variable??

2 Answers   GSK GlaxoSmithKline,


what is the difference btw proc means and proc univariate?

8 Answers   HSBC, TCS,


Name statements that function at both compile and execution time.

7 Answers   Accenture,


Suppose there is a SAS dataset with following values - Parent Child A B B C D E F G G H H I and so on….. This goes onto 1000s of observations/rows. Now how do we identify from this dataset Grandparents and Grandchildrens ?

5 Answers   American Express, Barclays,


Dear all, proc means data=dsn noprint completetypes; class trtmntgroup /preloadfmt; output out=tot n=n; format trtmntgroup trtf. ; by vstgrp descending severity; run; This is the code I used for AE table. I got the values without giving the variable ‘trtmntgroup(numeric)’ in var statement. And if I give the var statement for that variable i’m getting the same values.How is that possible? What is the difference between class and var statement? Could any one explain me how does proc means work at the back end. And what is the difference between _freq_ value and N value in proc means. Thanks and regards, Rajesh.

1 Answers  


What are the default statistics that proc means produce?

0 Answers  


Describe the function and untility of the most difficult SAS macro that you have written.

0 Answers  


Categories