In my dataset, a calculated field for age is being used to track subjects' progress. Code for a simulation is provided below.
Rather than manually inspect >1200 records, I wish to detect whether age (when observations are sorted on id & date)
increases (as in id==1), or does not change (as in id==2), or decreases (as in id==3). Is there a way to do this?
Rather than manually inspect >1200 records, I wish to detect whether age (when observations are sorted on id & date)
increases (as in id==1), or does not change (as in id==2), or decreases (as in id==3). Is there a way to do this?
Code:
set more off clear set obs 9 input id age str9 date 1 40.0 21jan2016 1 40.5 15jun2016 1 40.9 10dec2016 2 40.0 21jan2016 2 40.0 15jun2016 2 40.0 21jan2016 3 40.9 21jan2016 3 40.5 15jun2016 3 40.0 10dec2016 end gen sif_date = date(date, "DMY") format sif_date %td drop date sort id sif_date l, noo sepby(id)
Comment