04-09-2014 06:19 PM
I am trying to merge two data sets and then create new variables from these data sets. In my library, I have two data sets (cross1 and long1) with the common variable MEDRNO. I'm trying to merge them and create two new variables (change_dilation and change_time). For these new variables, i want to take the difference between the first observation of dilation and all other observations of dilation. The same goes with change_time. However, I'm not getting any observations in my output. Any idea what I am doing wrong?
libname Hwk4 'C:\Users\USERABC\Desktop\Assignment 4';
proc sort data=hwk4.cross1;by MEDRNO;
proc sort data=hwk4.long1;by MEDRNO;
merge hwk4.cross1 hwk4.long1;
if first.MEDRNO = 1 then do;
base_dil = DILATION;
t0 = time;
retain base_dil t0;
change_dilation = DILATION - base_dil;
change_time = time - t0;
04-10-2014 01:37 AM
For question 2b use set statement and use retain statement before set statement and try if still find problem then elobrate you issue using some dummy data.