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

Re: st: looping across an unknown number of columns


From   Jason Rachlin <[email protected]>
To   [email protected]
Subject   Re: st: looping across an unknown number of columns
Date   Tue, 10 Aug 2004 11:40:12 +0100

It looks like the top of my message got chopped:

I am reshaping my data so each date becomes a column.  I will not know how many
dates are in my dataset and thus will not know how many columns I have.  I'd like
to loop across the columns performing an operation once for each date.

Jason Rachlin wrote:

> program then loops over these dates performing a function.  I'd like to loop
> until I hit the last date in my dataset which will change each time I run the
> program depending on the size of the dataset.  Can someone please recommend an
> efficient way to identify my last column so I can define NumDays?
>
> local NumDays = ?
> local i = 1
> while `i' <= NumDays {
>     ...
> }
>
> cheers!
>
> *
> *   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/

--
NOTICE: If received in error, please destroy and notify sender.  Sender does not
waive confidentiality or privilege, and use is prohibited.


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