Statalist The Stata Listserver


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

RE: st: Looping across variables in variable columns


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Looping across variables in variable columns
Date   Fri, 27 Apr 2007 09:09:52 +0100

Glad you were helped by the responses. 

Meanwhile, the mystery of what -rowcount- is remains. 

Nick 
[email protected] 

Mungai, Edward
 
> Thank you all who gave ideas on this querry.
>  
> Being new to stata I have chosen and  managed to implement 
> solution 1B and taken into consideration other comments 
> relating to missing values. I am motivated to learn more stata!.
  
n j cox
 
> I can't find -rowcount- using -findit- or Google. Recall the 
> precept in
> the Statalist FAQ:
> 
> "Say what command(s) you are using. If they are not part of official
> Stata, say where they come from: the STB/SJ, SSC, or other archives."
> 
> That said, this is a nice problem. It has got enough spin (cricket
> sense, not public relations!) to be interesting, yet yields 
> to a little knowledge of Stata.

... 
 
Mungai, Edward <[email protected]>
 
> I have seen discussions on looping across an unknown number of columns
> which can be solved by -reshape-.
> 
> My question is how to sum across columns where the number of columns
> varies from one observation to the next.  i.e. I may need to 
> sum columns
> 2 to 5 for the first observation but from columns 4 to  11 for the
> second observation. In all cases the summation is done across a set of
> adjacent columns.
> 
> I have tried to use -rowcount-,  and the looping functions 
> but as far as
> I can tell all sum across a fixed number of columns from one 
> observation
> to the next. But there is something good also; the information on the
> column to  begin and the column to end the summation for each
> observation is contained  in two adjacent column which are 
> the same for
> all the observations.

*
*   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