Code:
gen AESTDAT = Diarydate if event=="Start"
Code:
tostring event, generate (event2) tostring Diarydate, generate (Diarydate2) gen AESTDAT= Diarydate2 if event2==1
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str1 STUDY_ID int AERPTDAT double AERPTIME str18 AETERM int Diarydate str5 event byte AESEV "A" 22834 -1893385652000 "Increased appetite" 22638 "Start" 2 "A" 22834 -1893385652000 "Increased appetite" 22640 "End" 2 "A" 22834 -1893385652000 "Headache" 22639 "Start" 2 "A" 22834 -1893385652000 "Headache" 22640 "End" 2 "A" 22834 -1893385652000 "Decreased appetite" 22639 "Start" 2 "A" 22834 -1893385652000 "Decreased appetite" 22641 "End" 2 "A" 22834 -1893385652000 "Abdominal pain" 22639 "Start" 2 "A" 22834 -1893385652000 "Abdominal pain" 22640 "End" 2 "A" 22834 -1893385652000 "Abdominal pain" 22643 "Start" 2 "A" 22834 -1893385652000 "Abdominal pain" 22644 "End" 2 "B" 22834 -1893385652000 "Headache" 22719 "Start" 3 "B" 22834 -1893385652000 "Headache" 22720 "End" 3 "B" 22834 -1893385652000 "Headache" 22721 "Start" 3 "C" 22834 -1893385652000 "High BP" 22600 "Start" 2 "C" 22834 -1893385652000 "High BP" 22605 "End" 2 end format %tddd-Mon-YY AERPTDAT format %tcHH:MM:SS AERPTIME format %tddd-Mon-YY Diarydate
Jenna
0 Response to Generate a date variable from another date variable with an if condition
Post a Comment