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
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 |
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 |
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 |
What are the features of base sas system?
What is shift table? have you ever created shift that?
2 Answers Accenture, Clinical Research, Quintiles,
sas macros
What is the order of evaluation of the comparison && logical && relational operators:?
Hi, I need to create a SAS Map of USA using SAS Graphs(Proc Gmap).The data i have dosent contain any co-ordinates of USA cities or counties or states, and the zip codes are diffrent in the data i have from the zip code in the Maps.US dataset in the Maps Library for SAS MAPS. the data i have is a sales report. i have to generate the maps according to the states,cities aligned in the sales data, HELP Appriciated
How is character variable converted into numeric variable and vice versa?
1.How many ways are there to create variables? 2.What is CLM,how can we use it? 3.what are the advontages of data step? 4.what is the extension of editor window in SAS 9.1.3? 5.How do you copy a particular data set from one library to another? 6.what is the use of double option? 7.Advontages of Proc Report? 8.what is the basic use of where statement? 9.How do you terminate the statments in SAS Programming? 10.What is the difference between symput and symget? 11.How would a identify the local and global variable? can any one answer for the 4'th question
Mention sas system options to debug sas macros.
Explain the purpose of substr functions in sas programming.
What is the difference between the proc sql and data step?
What do the SAS log messages "numeric values have been converted to character" mean?
How to get top scorer student from a class-table having different sections A,B, C & D? Each section having same number of students.