Dear All, I have this data set
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long(patient_id appo_date) str4 discipline str1 attended_ind
 335 18652 "NURA" "Y"
 335 19041 "DMRS" "Y"
 335 19376 "NURA" "N"
 347 18401 "NURA" "Y"
 347 19128 "NURA" "Y"
 347 19156 "DMRS" "Y"
 393 18976 "DMRS" "Y"
 393 18998 "NURA" "Y"
 395 18556 "NURA" "Y"
 395 19262 "NURA" "Y"
 395 19277 "DMRS" "Y"
 395 19438 "SCCC" "Y"
 802 18674 "DMRS" "N"
 802 19192 "DMRS" "Y"
 802 19220 "NURA" "Y"
 872 19397 "DMRS" "Y"
 907 18218 "NURA" "Y"
 907 18259 "NURI" "Y"
 907 18259 "ACDI" "Y"
 907 18287 "NURI" "Y"
 907 18287 "ACDI" "Y"
 907 18294 "ACDI" "Y"
 907 18294 "NURI" "Y"
 907 18315 "NURI" "Y"
 907 18315 "ACDI" "Y"
 907 18364 "ACDI" "Y"
 907 18364 "NURI" "Y"
 907 18420 "ACDI" "Y"
 907 18420 "NURI" "Y"
 907 18448 "NURI" "Y"
 907 18448 "ACDI" "Y"
 907 18504 "ACDI" "Y"
 907 18504 "NURI" "Y"
 907 18560 "ACDI" "Y"
 907 18560 "NURI" "Y"
 907 18604 "NURA" "Y"
 907 18644 "NURI" "Y"
 907 18644 "ACDI" "Y"
 907 19304 "NURA" "Y"
 907 19314 "DMRS" "Y"
 934 19198 "DMRS" "N"
 934 19207 "DMRS" "Y"
 934 19241 "NURA" "N"
1000 18376 "NURA" "N"
1000 18411 "NURA" "Y"
1000 18998 "NURI" "Y"
1000 19082 "NURI" "Y"
1000 19129 "NURA" "Y"
1000 19132 "DMRS" "Y"
1031 18975 "NURA" "Y"
1031 18975 "DMRS" "Y"
1031 18977 "NURI" "Y"
1071 18716 "NURA" "Y"
1071 19418 "NURA" "Y"
1071 19451 "DMRS" "Y"
1240 19068 "DMRS" "Y"
1240 19076 "NURA" "Y"
1240 19214 "PHYT" "Y"
1240 19431 "DMRS" "Y"
1240 19431 "PHYT" "Y"
1240 19460 "NURA" "Y"
1240 19463 "PODI" "Y"
1270 18873 "NURI" "Y"
1270 18900 "NURA" "N"
1270 18908 "DMRS" "N"
1270 18912 "NURI" "N"
1270 19339 "DMRS" "Y"
1316 18967 "DMRS" "Y"
1316 18976 "DMRS" "Y"
1316 19009 "NURA" "N"
1316 19044 "NURA" "Y"
1316 19044 "NURI" "Y"
1316 19141 "DMRS" "Y"
1316 19386 "DMRS" "Y"
1511 18305 "NURA" "Y"
1511 18410 "DIET" "Y"
1511 18438 "DIET" "N"
1511 18982 "NURI" "Y"
1511 19033 "NURA" "N"
1511 19065 "DMRS" "Y"
1511 19096 "NURA" "Y"
1511 19437 "DMRS" "Y"
1799 18189 "NURA" "N"
1799 18305 "NURA" "N"
2027 19129 "NURA" "Y"
2027 19129 "DMRS" "Y"
2320 19055 "DMRS" "Y"
2556 18212 "NURA" "Y"
2556 18592 "NURA" "Y"
2556 19292 "NURA" "Y"
2556 19307 "DMRS" "Y"
2561 18728 "DMRS" "Y"
2561 18758 "NURA" "Y"
2561 18952 "DMRS" "Y"
2561 18956 "DIET" "Y"
2561 19061 "DIET" "Y"
2561 19187 "DIET" "Y"
2561 19320 "DIET" "Y"
2561 19481 "DIET" "N"
2606 18246 "NURA" "Y"
end
format %tdD_m_Y appo_date
I have done the following,
Code:
label define a 1 "Y" 0 "N"
encode attended_ind, gen(a)
collapse (sum) a if appo_date <= 19082 & discipline == "NURA", by(patient_id)
drop if a == 0
I recall that there is a formal way to use something like `=mar312012' (???) instead of the number 19082. Any suggestions? And, where can I find more information about the corresponding command? Thanks.