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: Problem with parsing inputs to ado files


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Problem with parsing inputs to ado files
Date   Mon, 23 Jul 2012 16:31:20 +0100

Pradipto's program defines a command (not a function). 

I think he wants 

program define drif
	drop if `0'
end

Nick 
[email protected] 

Pradipto Banerjee

I tend to use "drop if ..." a huge number of times - and so I decided to write a ado function just to reduce "drop if" from seven letters to four letters

---
program define drif

drop if `*'

end
---

However, the above code breaks down when there are strings. For instance, if will work fine as

. drif var1>cons1 & var2<cons2

but will not work when I try

. drif var1=="cons1" & var2~="cons2"

Is there any easy way to fix the ado function to handle strings properly?

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