We want to merge file A and B. File A has variable age,
file B provide birthdate. How to merge the data according
to age in file B

Answers were Sorted based on User's Feedback



We want to merge file A and B. File A has variable age, file B provide birthdate. How to merge t..

Answer / ramesh

First calculate age in B datase


data age;
set b;
age=int(intck('day',bday,today())/365.25);
run;

sort both datasets by the age key variable and Use the
merge statement to combine the both datasets

Is This Answer Correct ?    10 Yes 1 No

We want to merge file A and B. File A has variable age, file B provide birthdate. How to merge t..

Answer / vishal

Calculate age in dataset B by using the following code:
data ages;
set b;
retain current;
if _n_=1 then current=today();
format bday current worddate20.;
age=int(intck('month',bday,current)/12);
if month(bday)=month(current) then
age=age-(day(bday)>day(current));
run;

Source: http://support.sas.com/kb/24/567.html

Is This Answer Correct ?    0 Yes 0 No

We want to merge file A and B. File A has variable age, file B provide birthdate. How to merge t..

Answer / alok karan

First calculate age in BB dataset:

data bbb;
set bb;
age=round(yrdif(birthdate,today(),'Actual'),1);
run;
proc sort data=bbb;
by age;
drop birthdate;
run;

Now merge both dataset by age variable:
data abc;
merge aa bbb;
by age;
run;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SAS Interview Questions

what are sas bi dashboard components? : Sas-bi

0 Answers  


To what type of programms have you used scratch macros?

0 Answers   Novartis,


You need to create an In List that it is to be later used in a Where Clause that includes all the Regions that begin with the letter A from the sashelp.shoes table. Using PROC SQL with an into clause create the following string from the sashelp.shoes table using the variable region “AFRICA”,”ASIA”,…..

3 Answers  


Did you used proc test? when?

0 Answers   Accenture, Quintiles,


Where do you use proc means over proc freq?

0 Answers  






Have you ever linked SAS code? If so, describe the link and any required statements used to either process the code or the step itself.

2 Answers   Accenture,


what is the Population you used in your project, is it ITT or PP?

0 Answers   Accenture, Quintiles,


how many data types in sas? : Sas-administrator

1 Answers  


What is the use of divide function?

0 Answers  


Do you need to rearrange the order of the data for the report?

0 Answers  


How the date 04oct1994 is stored in SAS,not only give the answer explain in brief?

5 Answers  


in data set200 observation how to take 110,150,170 using sql procedure?

7 Answers   Accenture,


Categories