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: make syntax options optional
From
tashi lama <[email protected]>
To
<[email protected]>
Subject
st: make syntax options optional
Date
Tue, 11 Sep 2012 02:16:07 +0000
Hello all,
//begin file.ado //
program file
syntax, doc_id(int) [firm_id(int)]
if "`firm_id'"!="" {
odbc load, exec("select * from readership where id_value=`doc_id' and source_id=`firm_id' ")
}
else {
odbc load, exec("select * from readership where id_value=`doc_id' ")
}
list
end
. file, doc_id(7) firm_id(6429)
invalid syntax
I searched for archive and found out that we need to give a default value for optional options like following
syntax, doc_id(int) [firm_id(int 5)]
I am not sure if I understood this. Does this not fix firm_id=5? In my case, firm_id will vary. Any idea or hint will be highly appreciated.
Thanks,
Tashi
*
* 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/