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 |
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
explain the use of % includes a statement in sas? : Sas-administrator
What are exact SAS Base contents..?N what r SAS Tools..?
Explain what is data step?
explain the key concept of sas? : Sas-administrator
What is the order of application for output data set options, input data set options and SAS statements?
how does sas handle missing values in a merge? : Sas programming
SAS using companies in chennai
Does anybody has SAS Platform Administration certification dumps. pls send to hariithepalli@gmail.com
In which case u go for libname and in which case u go for proc sql pass thru facilit diff?
If i doest required Cumilative frequency in my table, generated by using PROC FREQ what i had to do?
what is the prob plot in clinical domain