Hi All,
I have a super basic question. Consider the following dataset:
What I wish to do, is to only keep those observations of var1, where var2==1. The dataset that I want, is that when this condition is satisfied (var2==1), all I have left is the first 4 rows of var1, and only var1 as a column.
This is achived by:
However, if I am to type:
I get an invalid sytanx error. Is there any obvious reason for this? If the command keep drops everything except what is followed, and if what is follows is only var1 by a specific condition, I do not see a reason why this should not work.
Many thanks,
CS
I have a super basic question. Consider the following dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(var1 var2 var3) 2 1 2 3 1 3 2 1 2 1 1 3 123 0 2 2 0 1 end
This is achived by:
Code:
keep if var2==1 keep var1
Code:
keep var1 if var2==1
Many thanks,
CS
Comment