Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Problem with parsing inputs to ado files


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
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 
n.j.cox@durham.ac.uk 

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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index