Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Loop question


From   Alberto R Osella <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Loop question
Date   Tue, 08 Feb 2011 10:22:17 +0100

Dear Stata Listers,
after a factor analysis (pca)  I'd want to create categorical variables
by using a loop. But I have some troubles. Here the code I'm using

predict P_R1 P_R2 P_R3 P_R4, regression
predict P_B1 P_B2 P_B3 P_B4, bartlett

foreach x of var  P_R1-P_B4 {
pctile q_`x'_c= `x' if caso_ctrol0==0 &  P_R1-P_B4 <., nq(5)
tab2 `x' caso_ctrol0
xtile `x'_q=`x', cutpoint( P_R1-P_B4_cut)
tab2 `x'_q caso_ctrol0
   }
and this is the error:
variable P_B4_cut not found
in option cutpoints()
r(111)
I'm using Stata 11.1 on windows 7.
Can anyone help me. Thank you.

--
Alberto R. Osella, MD, PhD
Laboratorio di Epidemiologia e Biostatistica
IRCCS Saverio de Bellis
Via Turi, 27
70013 Castellana Grotte (BA)
Italia
Tel:    +39 0804994655
Fax:    +39 0804994650
e-mail: [email protected]

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index