Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Type mismatch in while and somes issues with statalist


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: st: Type mismatch in while and somes issues with statalist
Date   Thu, 7 May 2009 22:44:41 +0100

I am not sure about the way you have constructed your code, but here
is a distinct solution (specific to the structure you have) - other
solutions would involve mata and -vecdiag()- etc.:

/* Begin */
clear
set obs 10
forv i=1/10 {
	g v`i'=`i' if _n==`i'
}
list, noobs
g collect=.
forv i=1/10 {
	replace collect=v`i' if _n==`i'
}
list collect
/* End */

T

On Thu, May 7, 2009 at 10:10 PM, Kalisperos <[email protected]> wrote:
> Hello all,
>
> I have three questions.  First, my data structure is like this:
>
> v1  v2  v3......
> 1    .    .
> .    2    .
> .    .    3
> ........
>
> To stack all observations in v1, I tried the following code, but Stata
> returns "type mismatch." How can I do this work?
>
> local i=4
> while `i'<5 {
> replace v`i'=v`i'+1 if v`i'==""
> local i=`i'+1
> }
>
>
> Second, If I send an email to statalist.by starting a new email, my mail is
> not posted. If I reply to an existing one, the mail goes through. I know
> this is not recommended. How can I post a new thread? Why can I not start a
> thread? I removed my account and resubscribed, but it did not work either.
>
>
> Third, I am receiving two same emails for every posting. Again, I removed my
> account and re-subscribed, but I am still getting two same emails of every
> posting. How can I fix this problem?
>
>
> Thank you for your help in advance.
> Mike.
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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