I have data in long format. I want to select the first value of the variable "days" which is <=300 for each subject. In the example below I want to select for subject/id1 50 days; for subject/id 2 none (because days>300) and for subject/id3 50 days. How do I do that for a whole dataset? Please help.
id days
1 50
1 100
1 600
2 1000
3 70
3 50
id days
1 50
1 100
1 600
2 1000
3 70
3 50

Comment