Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65037

Identify first observation in panel data and create categorical and binominal variables

$
0
0
Hello,

could you, please, help me with data management in Stata. I need to do survival analysis and have the data like this:

PatientN 0 12 24 36 48 60 72 84 96 108 120
1 38,0 38,1 38,6 37,6 38,0 37,2 37,6 36,7 37,0 36,4 36,9
2 39,5 38,8 39,8 37,6 37,8 36,8 37,2 36,6 36,8 36,4 36,6
3 38,5 37,6 38,4 36,6 36,9 36,6 36,2 36,4 36,4 36,4 36,6
4 38,5 37,8 40,0 38,8 37,8 36,8 38,0 36,4 36,8 36,6 36,4
5 39,4 38,8 39,6 37,2 38,6 36,4 37,0 36,4 36,6 36,2 36,4
6 38,4 38,2 38,6 36,6 37,4 36,4 36,6 36,4 36,2 36,2 36,4
7 39,2 38,6 39,2 37,4 37,6 37,1 37,2 37,5 37,0 36,6 36,4
8 38,1 37,1 38,0 37,8 38,0 37,0 38,1 36,6 36,8 36,4 36,6
9 38,8 37,8 38,6 36,4 37,8 36,6 36,4 36,1 36,8 36,4 36,6
10 38,0 37,2 38,0 37,4 38,2 37,0 37,2 36,6 36,4 36,4 36,6
13 39,1 37,8 37,6 36,7 37,0 36,4 36,8 36,4 36,7 36,2 36,8
15 38,8 37,8 37,6 37,6 37,6 37,6 37,6 37,6 37,6 37,6 37,6

Where PatientN - number of patient and 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120 - time in hours
Data is patients' temperature.

I need to identify the fist observation with temperature equil to 36.9 and less in rows and create variables with survaival time and status, like these:

PatientN 0 12 24 36 48 60 72 84 96 108 120 SurvTime Status
1 38,0 38,1 38,6 37,6 38,0 37,2 37,6 36,7 37,0 36,4 36,9 84,0 1,0
2 39,5 38,8 39,8 37,6 37,8 36,8 37,2 36,6 36,8 36,4 36,6 60,0 1,0
3 38,5 37,6 38,4 36,6 36,9 36,6 36,2 36,4 36,4 36,4 36,6 36,0 1,0
4 38,5 37,8 40,0 38,8 37,8 36,8 38,0 36,4 36,8 36,6 36,4 60,0 1,0
5 39,4 38,8 39,6 37,2 38,6 36,4 37,0 36,4 36,6 36,2 36,4 60,0 1,0
6 38,4 38,2 38,6 36,6 37,4 36,4 36,6 36,4 36,2 36,2 36,4 36,0 1,0
7 39,2 38,6 39,2 37,4 37,6 37,1 37,2 37,5 37,0 36,6 36,4 108,0 1,0
8 38,1 37,1 38,0 37,8 38,0 37,0 38,1 36,6 36,8 36,4 36,6 84,0 1,0
9 38,8 37,8 38,6 36,4 37,8 36,6 36,4 36,1 36,8 36,4 36,6 36,0 1,0
10 38,0 37,2 38,0 37,4 38,2 37,0 37,2 36,6 36,4 36,4 36,6 84,0 1,0
13 39,1 37,8 37,6 36,7 37,0 36,4 36,8 36,4 36,7 36,2 36,8 36,0 1,0
15 38,8 37,8 37,6 37,6 37,6 37,6 37,6 37,6 37,6 37,6 37,6 120,0 0,0


Viewing all articles
Browse latest Browse all 65037

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>