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: RE: RE: RE: Blinking message when using _rc


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: Blinking message when using _rc
Date   Wed, 28 Jul 2010 23:47:28 +0200

<>

Note the whole -count- and -drop- part could simply be -assert-ed:


***********
clear*
set obs 10
gen str1 A_X=""
gen str1 B_X=""
gen str1 C_X="p" in 2

local M "A B C"

foreach m of local M{
cap confirm var `m'_X
if !_rc {
	cap as mi(`m'_X)
	if !_rc drop `m'_X 
}
}
***********


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Mittwoch, 28. Juli 2010 23:26
To: [email protected]
Subject: st: RE: RE: Blinking message when using _rc

You may just have omitted an -if-. 

! as the first character on a line will, as Martin says, be interpreted
as a call to the shell.  

Your inner code can be compressed as you don't need to -confirm var-
twice. 

capture confirm variable `m'_X
if !_rc {
	quietly count if missing(`m'_X)
	if  r(N)==_N{
	drop `m'_X
	display "`m'_X" " dropped"
	}
	else replace `m'_X="1" if `m'_X=="P"
}

although the last will fail if the variable in question is numeric. 

Nick 
[email protected] 

Martin Weiss

Just issue 

***********
!_rc
***********

on its own to see the window. Without the -if- in front of it, it calls
the
OS, and the OS does not know "_rc"... "!" is a synonym for the Stata
command
-shell-...

Duha Altindag

I'm running the program below:

***start***
local M "A B C"
foreach m in `M' {

capture confirm variable `m'_X
!_rc {
quietly count if missing(`m'_X)
if  r(N)==_N{
drop `m'_X
display "`m'_X" " dropped"
}
}

capture confirm variable `m'_X
if !_rc {
replace `m'_X="1" if `m'_X=="P"
}
}
***end***

It does the job that I need. But while it is running, I see a black
windows window for just a moment each (literally), that gives me a
message that reads like:
"!_rc { is not recognized as an internal or external command, operable
program or batch file."
Because the program above runs many times, I see that window multiple
times for a moment, like blinking. I can hardly read it the moment I
see it, but I could write it down after running the code many times.
Does anyone have an idea of what that means?


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

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