Skip to content

Commit a79bc45

Browse files
committed
Fix minor bug affecting predict and margins
Before, if you ran predict or margins after ppmlhdfe WITHOUT an absorb() option, you would trigger a syntax error due due repeated "if" clauses ("replace .. = .. if .. if ..") This has been fixed
1 parent 5b3a6c4 commit a79bc45

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/ppmlhdfe.ado

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*! version 2.3.3 02nov2025
1+
*! version 2.3.4 11jan2025
22
*! Authors: Sergio Correia, Paulo Guimarães, Thomas Zylkin
33
*! URL: https://github.com/sergiocorreia/ppmlhdfe
44

src/ppmlhdfe.pkg

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ d KW: panel data
1919
d KW: separation
2020
d
2121
d Requires: Stata version 13.1
22-
d Required packages: ftools, reghdfe
2322
d
24-
d Author: Sergio Correia. Board of Governors of the Federal Reserve System
23+
d Required packages:
24+
d ftools
25+
d reghdfe
26+
d
27+
d Author: Sergio Correia. Federal Reserve Bank of Richmond
2528
d Support: sergio.correia@gmail.com
2629
d
2730
d Author: Paulo Guimarães. Banco de Portugal
@@ -30,7 +33,7 @@ d
3033
d Author: Thomas Zylkin. University of Richmond
3134
d Support: tzylkin@richmond.edu
3235
d
33-
d Distribution-Date: 20251102
36+
d Distribution-Date: 20260111
3437
d
3538
f ppmlhdfe.ado
3639
f ppmlhdfe_header.ado

src/ppmlhdfe.sthlp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{smcl}
2-
{* *! version 2.3.3 02nov2025}{...}
2+
{* *! version 2.3.4 11jan2025}{...}
33
{vieweralsosee "[R] poisson" "help poisson"}{...}
44
{vieweralsosee "[R] xtpoisson" "help xtpoisson"}{...}
55
{vieweralsosee "[R] glm" "help glm"}{...}

src/ppmlhdfe_p.ado

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ program define ppmlhdfe_p
3232

3333
loc opt `mu' `nondefault'
3434
loc y `e(depvar)'
35-
loc ifin `"`if' `in'"'
35+
loc ifin `"`in' `if'"' // put -in- first so we can add an -if- clause later in some cases
3636

3737
* Default option is mu
3838
if ("`opt'" == "") {
@@ -68,7 +68,10 @@ program define ppmlhdfe_p
6868
la var `varlist' "Linear prediction: xb + d[`e(absvars)']"
6969
}
7070
else {
71-
qui replace `varlist' = . if mi(`e(d)') `ifin'
71+
* only include "if" when -if- is empty (we can't test against -ifin- because -in- can exist)
72+
loc if_literal = cond(`"`if'"'=="", "if", "&")
73+
di as error `"qui replace `varlist' = . `ifin' `if_literal' mi(`e(d)') "'
74+
qui replace `varlist' = . `ifin' `if_literal' mi(`e(d)')
7275
la var `varlist' "Linear prediction: xb"
7376
}
7477

0 commit comments

Comments
 (0)