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

How experienced are you with customized reporting and use of Data _Null_ features?

4 Answers   Oracle,


i have multiple .csv files in a unix directory. every file is having variable names as header.even for empty file also. suppose take 3 files a.csv b.csv c.csv a.csv contains data as name;age,salary; raja;34;4000; ravi;33;5000; kumar;25;3000; b.csv contains data as name;age,salary; ajay;40;4500; and c.csv contains name;age,salary; (only headers) Now i want to import and append all these files in to a single dataset. i tried infile statement with *.csv to import all at a time. but i m not getting correct data. please help me . its urgent. thank you in advance

2 Answers   Tech Mahindra,


How to find out no. of business days in a month using macros.???(excluding weekends and holidays).

2 Answers   HSBC,


What do the mod and int function do? : Sas programming

0 Answers  


How do dates work in sas?

0 Answers  






Will it bother you if the guy at the next desk times the frequency and duration of your bathroom or coffee breaks on the grounds that ?you are getting paid twice as much as he is??

0 Answers   Oracle,


What are the differences between proc means and proc summary?

0 Answers  


explain the difference between proc means and proc summary?

0 Answers  


If you could design your ideal job, what would it look like?

0 Answers   Oracle,


Explain proc univariate?

0 Answers  


which stats created by proc means that are not created by proc summary or vice versa?

2 Answers   GSK,


What are the difference between the sas data step and sas procs?

0 Answers  


Categories