Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: Re: st: Queries about dfl


From   n j cox <[email protected]>
To   [email protected]
Subject   Re: Re: st: Queries about dfl
Date   Mon, 22 Oct 2007 10:31:53 +0100

If

local ct = wordcount("`varlist'")

is biting then another fix is to use instead

local ct : word count `varlist'

which is not subject to the same limits. There would then
be no need to change the syntax. (Not tested.)

Nick
[email protected]

Peter Siminski

Hipólito Simón had some queries on the dfl- module to estimating DiNardo,
Fortin and Lemieux Counterfactual Kernel Density (see below). I can’t speak
for the rest of the module, but I also had the problem of getting the module
to use all of my variables, which I investigated.

I think the issue is with the wordcount function, which appears as follows
in the program:
local ct=wordcount("`varlist'")

If I’m not mistaken, this function first converts the `varlist’ macro into a
string and then counts the number of words in that string. It further
appears that this string is truncated if it exceeds the string size limit (I
think 244 characters in my Stata).

I’m not an experienced Stata programmer, but the following modification
seems to fix the problem. Here, the dependent variable is entered as a
separate argument after the comma (instead of part of the varlist at the
start) and then the section with wordcount isn’t necessary.:


    syntax [varlist(default=none)] [if] [in], depvar(varname)
outcome(varname) [ group(varname) ///
        graph(string) min(real -99) max(real -99) nbins(real 200) w(real
-99) ///
        step(varlist) adaptive gauss epan oaxaca quietly nogrt(string)
probit  ///
        ylabel(string) xlabel(string) colfirst ycommon  xcommon  copies
nodraw ///
        rows(string) cols(string) holes(string) iscale(string)
iscale(string) ///
        imargin(string) name3(string) saving(string) xtitle(string)
nxvar(string) ///
        ncfactual(string) nufactual(string) nfactual(string)title(string)
subtitle(string) ///
        note(string) caption(string) t1title(string)
t2title(string)b1title(string) b2title(string) ///
        l1title(string) l2title(string) r1title(string) r2title(string)
legend(string) grtpos(string) ///
        xscale(string)]

    tempvar phat wgt x ufactual factual cfactual diff outcome2 x cfwage
cfwage2 lwage2 ///
        cfwage3 lwage3 diff_all

        local rhs `varlist'

    if ("`nxvar'"=="") {

THE LAST LINE HERE IS IDENTICAL TO THE ORIGINAL MODULE AND I DIDN’T NEED TO
CHANGE THE REST OF THE MODULE.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index