Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: why can't STATA add odd numbers?


From   Ronnie Babigumira <[email protected]>
To   [email protected]
Subject   Re: st: why can't STATA add odd numbers?
Date   Sun, 23 Apr 2006 21:33:45 +0200

Not an answer to your question. A suggestion, if these are identifiers (county tifdistrict), why dont you hold them as strings and then simply concatenate them

David Merriman wrote:

three variables

code is a 4 or 5 digit number between 1126 and 99047
countycode is a 1 or 2 digit code between 1 and 77
tifdistrict is 1 or 2 digit code between 1 and 50

I create tidcode as follows:
generate tidcode=(code*10000)+(100*countycode)+(1*tifdistrict)
(I'm thinking this will generate a 9 digit number--the first five
digits will be code, the next two digits will be countycode and the last
two digits will be tifdistrict)

I get very weird results. Sometimes Stata does just what I want but
sometimes TID code is 1 digit too low. Below I show some of the inputs
and outputs. Note that observation 103 is wrong but observation 104 through 106 is fine. It seems to be that STATA gets if wrong when
tifdistrict is odd. I imagine this is something to do with formatting
but tifdistrict is formatted %6.3f and tidcode is formatted %18.2f

Ideas greatly appreciated.


+----------------------------------------------+
tidcode code county~e tifdis~t ----------------------------------------------
100. . 2106.000 2.000 . 101. . 2106.000 2.000 . 102. . 2106.000 2.000 . 103. 22010204.00 2201.000 2.000 5.000 104. 22010204.00 2201.000 2.000 4.000 ----------------------------------------------
105. 22010208.00 2201.000 2.000 8.000 106. 22010204.00 2201.000 2.000 4.000 107. 22010204.00 2201.000 2.000 5.000 108. 22010206.00 2201.000 2.000 6.000 109. 22010204.00 2201.000 2.000 5.000 ----------------------------------------------
110. 22010206.00 2201.000 2.000 6.000 111. 22010208.00 2201.000 2.000 8.000 112. 22010208.00 2201.000 2.000 7.000 113. 22010206.00 2201.000 2.000 6.000 114. 22010208.00 2201.000 2.000 8.000 ----------------------------------------------
115. 22010208.00 2201.000 2.000 7.000 116. 22010204.00 2201.000 2.000 4.000 117. 22010208.00 2201.000 2.000 7.000 118. 22010208.00 2201.000 2.000 7.000 119. 22010204.00 2201.000 2.000 3.000 ----------------------------------------------
120. 22010204.00 2201.000 2.000 3.000 121. 22010204.00 2201.000 2.000 3.000 122. 22010204.00 2201.000 2.000 5.000 123. 22010208.00 2201.000 2.000 8.000 124. 22010208.00 2201.000 2.000 7.000 ----------------------------------------------
125. 22010206.00 2201.000 2.000 6.000 126. 22010206.00 2201.000 2.000 6.000 127. 22010206.00 2201.000 2.000 6.000 128. 22010204.00 2201.000 2.000 3.000 129. 22010204.00 2201.000 2.000 4.000 ----------------------------------------------
130. 22010208.00 2201.000 2.000 7.000 131. 22010208.00 2201.000 2.000 7.000 132. 22010204.00 2201.000 2.000 4.000 133. 22010206.00 2201.000 2.000 6.000 134. 22010204.00 2201.000 2.000 5.000 ----------------------------------------------
135. 22010204.00 2201.000 2.000 3.000 136. 22010206.00 2201.000 2.000 6.000 137. 22010204.00 2201.000 2.000 5.000 138. 22010204.00 2201.000 2.000 5.000 139. 22010208.00 2201.000 2.000 8.000 ----------------------------------------------
140. 22010204.00 2201.000 2.000 5.000 141. 22010208.00 2201.000 2.000 7.000 142. 22010204.00 2201.000 2.000 3.000 143. 22010204.00 2201.000 2.000 5.000 144. 22010204.00 2201.000 2.000 4.000 ----------------------------------------------
145. 22010204.00 2201.000 2.000 4.000 146. 22010204.00 2201.000 2.000 4.000 147. 22010204.00 2201.000 2.000 3.000 148. 22010204.00 2201.000 2.000 3.000 149. 22010204.00 2201.000 2.000 3.000 ----------------------------------------------
150. 22010204.00 2201.000 2.000 3.000 151. 22010204.00 2201.000 2.000 3.000 152. 22010204.00 2201.000 2.000 4.000 153. 22010204.00 2201.000 2.000 3.000 154. 22010204.00 2201.000 2.000 4.000 ----------------------------------------------
155. 22010206.00 2201.000 2.000 6.000 156. 22010208.00 2201.000 2.000 8.000 157. 22010204.00 2201.000 2.000 4.000 158. 22010204.00 2201.000 2.000 4.000 159. 22010204.00 2201.000 2.000 5.000 ----------------------------------------------
160. 22010208.00 2201.000 2.000 8.000 161. 22010206.00 2201.000 2.000 6.000 162. 22010208.00 2201.000 2.000 8.000 163. 22010208.00 2201.000 2.000 7.000 164. 22010208.00 2201.000 2.000 8.000 ----------------------------------------------
165. 22010204.00 2201.000 2.000 4.000 166. 22010204.00 2201.000 2.000 5.000 167. 22010204.00 2201.000 2.000 5.000 168. 22010208.00 2201.000 2.000 8.000 169. 22010206.00 2201.000 2.000 6.000 ----------------------------------------------
170. 22010204.00 2201.000 2.000 3.000 171. 22010204.00 2201.000 2.000 3.000 172. 22010204.00 2201.000 2.000 5.000 173. 22010208.00 2201.000 2.000 7.000 174. 22010208.00 2201.000 2.000 7.000 ----------------------------------------------
175. 22010206.00 2201.000 2.000 6.000 176. 22010208.00 2201.000 2.000 7.000 177. 22010208.00 2201.000 2.000 7.000 178. 22010208.00 2201.000 2.000 7.000 179. 22010204.00 2201.000 2.000 4.000 ----------------------------------------------
180. 22010208.00 2201.000 2.000 8.000 181. 22010206.00 2201.000 2.000 6.000 182. 22010208.00 2201.000 2.000 8.000 183. 22010204.00 2201.000 2.000 4.000 184. 22010204.00 2201.000 2.000 4.000 ----------------------------------------------
185. 22010204.00 2201.000 2.000 3.000 186. 22010208.00 2201.000 2.000 7.000 187. 22010204.00 2201.000 2.000 5.000 188. 22010204.00 2201.000 2.000 3.000 189. 22010204.00 2201.000 2.000 3.000 ----------------------------------------------
190. 22010206.00 2201.000 2.000 6.000 191. 22010206.00 2201.000 2.000 6.000 192. 22010208.00 2201.000 2.000 7.000 193. 22010208.00 2201.000 2.000 8.000 194. 22010208.00 2201.000 2.000 8.000 ----------------------------------------------
195. 22010204.00 2201.000 2.000 5.000 196. 22010204.00 2201.000 2.000 5.000 197. 22010208.00 2201.000 2.000 8.000 198. 22010206.00 2201.000 2.000 6.000 199. 22010204.00 2201.000 2.000 4.000 ----------------------------------------------
200. 22010208.00 2201.000 2.000 8.000

David Merriman
School of Business Administration
Loyola University Chicago
1 E. Pearson Street
Room 534
Chicago, Illinois 60611
phone 312-915-6071
fax 312-915-8508
e-mail [email protected]

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index