Hello,
Stata seems to be exhibiting erratic behavior that I cannot explain. I am just trying to use a particular value of a string variable for an "if" condition, but it keeps returning the error "no observations". I have literally copied the string value out of the codebook output, so I am completely baffled as to why. Trying a count command gives me the same issue. I have no idea what to do next. Hoping someone here has some ideas?
See code below. I am just trying to look at data points for which catalog=="206.5", but there appears to be no way to do this, as the data tells me that there are no values, even though codebook shows that "206.5" is a valid codebook value for this variable, and even though tabulate shows thousands of data points for this value.
. codebook catalog
---------------------------------------------------------------------------------
catalog Catalog
---------------------------------------------------------------------------------
Type: String (str8)
Unique values: 38 Missing "": 0/194,434
Examples: "56"
"150"
"150.5"
"206.5"
Warning: Variable has leading blanks.
. tabulate catalog
Catalog | Freq. Percent Cum.
------------+-----------------------------------
WK51 | 446 0.23 0.23
8 | 13,187 6.78 7.01
12 | 10,984 5.65 12.66
14 | 902 0.46 13.12
41 | 1,242 0.64 13.76
51 | 10,419 5.36 19.12
56 | 12,729 6.55 25.67
56.5 | 2,123 1.09 26.76
100 | 3,243 1.67 28.43
104 | 11,333 5.83 34.26
104.5 | 311 0.16 34.42
109 | 1,089 0.56 34.98
110 | 907 0.47 35.44
150 | 38,648 19.88 55.32
150.5 | 12,775 6.57 61.89
156 | 61 0.03 61.92
156.5 | 374 0.19 62.12
160 | 1,025 0.53 62.64
161 | 3,931 2.02 64.66
161.5 | 3,064 1.58 66.24
200 | 401 0.21 66.45
206 | 8,912 4.58 71.03
206.5 | 17,590 9.05 80.08
209 | 4,917 2.53 82.61
214 | 1,182 0.61 83.21
214.5 | 1,411 0.73 83.94
216 | 932 0.48 84.42
300 | 75 0.04 84.46
301 | 18,358 9.44 93.90
302 | 7,704 3.96 97.86
303 | 2,056 1.06 98.92
310 | 49 0.03 98.94
315 | 983 0.51 99.45
320 | 70 0.04 99.49
501 | 983 0.51 99.99
505 | 8 0.00 99.99
601 | 9 0.00 100.00
903 | 1 0.00 100.00
------------+-----------------------------------
Total | 194,434 100.00
. count if catalog=="206.5"
0
. tabulate success term if catalog=="206.5"
no observations
Stata seems to be exhibiting erratic behavior that I cannot explain. I am just trying to use a particular value of a string variable for an "if" condition, but it keeps returning the error "no observations". I have literally copied the string value out of the codebook output, so I am completely baffled as to why. Trying a count command gives me the same issue. I have no idea what to do next. Hoping someone here has some ideas?
See code below. I am just trying to look at data points for which catalog=="206.5", but there appears to be no way to do this, as the data tells me that there are no values, even though codebook shows that "206.5" is a valid codebook value for this variable, and even though tabulate shows thousands of data points for this value.
. codebook catalog
---------------------------------------------------------------------------------
catalog Catalog
---------------------------------------------------------------------------------
Type: String (str8)
Unique values: 38 Missing "": 0/194,434
Examples: "56"
"150"
"150.5"
"206.5"
Warning: Variable has leading blanks.
. tabulate catalog
Catalog | Freq. Percent Cum.
------------+-----------------------------------
WK51 | 446 0.23 0.23
8 | 13,187 6.78 7.01
12 | 10,984 5.65 12.66
14 | 902 0.46 13.12
41 | 1,242 0.64 13.76
51 | 10,419 5.36 19.12
56 | 12,729 6.55 25.67
56.5 | 2,123 1.09 26.76
100 | 3,243 1.67 28.43
104 | 11,333 5.83 34.26
104.5 | 311 0.16 34.42
109 | 1,089 0.56 34.98
110 | 907 0.47 35.44
150 | 38,648 19.88 55.32
150.5 | 12,775 6.57 61.89
156 | 61 0.03 61.92
156.5 | 374 0.19 62.12
160 | 1,025 0.53 62.64
161 | 3,931 2.02 64.66
161.5 | 3,064 1.58 66.24
200 | 401 0.21 66.45
206 | 8,912 4.58 71.03
206.5 | 17,590 9.05 80.08
209 | 4,917 2.53 82.61
214 | 1,182 0.61 83.21
214.5 | 1,411 0.73 83.94
216 | 932 0.48 84.42
300 | 75 0.04 84.46
301 | 18,358 9.44 93.90
302 | 7,704 3.96 97.86
303 | 2,056 1.06 98.92
310 | 49 0.03 98.94
315 | 983 0.51 99.45
320 | 70 0.04 99.49
501 | 983 0.51 99.99
505 | 8 0.00 99.99
601 | 9 0.00 100.00
903 | 1 0.00 100.00
------------+-----------------------------------
Total | 194,434 100.00
. count if catalog=="206.5"
0
. tabulate success term if catalog=="206.5"
no observations
Comment