Can anyone help with this annoying problem I have? I've tried several
solutions, and I've searched the archives, the FAQs, [U] and looked at
-whelp recode- and -whelp generate- for one, without success.
I have some data, of which is an exciting snippet
. l clmarg conlab in 40/60, sep(0)
+-------------------+
| clmarg conlab |
|-------------------|
40. | 1.220839 0 |
41. | 1.092907 0 |
42. | 1.085126 0 |
43. | .9743952 0 |
44. | 1.054179 1 |
45. | 1.129007 1 |
46. | 1.125071 1 |
47. | 1.105309 1 |
48. | 1.027237 1 |
49. | 1.049828 0 |
50. | 1.061838 1 |
51. | 1.131486 1 |
52. | 1.182975 0 |
53. | 1.16508 0 |
54. | 1.157947 1 |
55. | 1.014532 1 |
56. | 1.033752 0 |
57. | .9131435 0 |
58. | .9487363 0 |
59. | .9845221 0 |
60. | .9323835 0 |
+-------------------+
where I am looking to -generate- a dummy variable, <cl1>, which scores 1
if, _and only if_, (a) <conlab> = 1 and (b) if <clmarg> lies in the range
.95 and 1.05 (inclusive).
The 'best' attempt I've come up with so far is
. g cl1=1 if (clmarg>=.95 | clmarg<=1.05) & conlab==1 & clmargin <.
but the outcome here is that <cl1> = 1 where <conlab> = 1, regardless of
the value of <clmarg>. Clearly, one -if- condition has overriden the other
in this command (passing over the missings), because they overlap.
Are there any one-shot solutions that avoid this problem? Thanks very much.
CLIVE NICHOLAS |t: 0(044)7903 397793
Politics |e: [email protected]
Newcastle University |http://www.ncl.ac.uk/geps
Whereever you go and whatever you do, just remember this. No matter how
many like you, admire you, love you or adore you, the number of people
turning up to your funeral will be largely determined by local weather
conditions.
*
* 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/