Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: scrolling over observations

From   "Michael Blasnik" <>
To   <>
Subject   st: Re: scrolling over observations
Date   Tue, 1 Feb 2005 07:30:00 -0500

The error from encode indicates that your company name variable was actually numeric to start with (I assume it was just some numeric code of some type but not already encoded?). In that case, encode certainly wouldn't work and the other solutions make sense.

Michael Blasnik

----- Original Message ----- From: "Dr. J. Clovis, Economics" <>
To: <>
Sent: Tuesday, February 01, 2005 5:46 AM
Subject: st: scrolling over observations

Dear listers,
I am grateful to Michael Blasnik, Scott Merryman, Russell Diamond and Nick Cox for their helpful advice and code.

Russell's code worked best, either as it was, or with Nick's modifications. Michael's made Stata complain "not possible with numeric variable" and would not work even after I used decode. Scott's code produced the same effect as my original code, namely '1' at the start of each block of observations of a company, and '0' for the rest of the block.

Thanks to Nick Cox for the additional advice concerning why the incrementing of `count'+1 in my code would not work.

I now have code which allows me to identify a large number of companies by a numeric tag and to be able to count the total number in one easy line.

Once again my thanks to all who contributed.

Joel Clovis

Dr. J.S. Clovis,

* For searches and help try:
*   For searches and help try:

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