This uses the "sysuse auto" stata dataset.
The command I was intending to type was
replace price=10 if _n==50
However, I mistakenly typed the syntax
replace price if _n=50
This second command changed the value of price to 50 for all 74 rows of the dataset.
I was hoping someone could explain the logic behind this. It wasn't something I would have expected had I just seen the code.
Thanks,
Peter.
Related Posts with Explaining output from replace command
Problem setting base category in interaction termHi everyone, I have a question about choosing the base level of a factor variable in an interaction …
Adjust for time constant covariate in mixed effects regression using multiple imputationI would like to ask for advice regarding the following question: I would like to compute a mixed eff…
Ordinal regression modelHello, Does anyone know how the output of a gologit2 (generalized ordinal regression) command is in…
Quintile SortingHello I have a dataset of investment funds and want to divide the variable Turnover into 5 quintiles…
Repeated cross-section: gen new variable combining three survey yearsHello, In order to obtain repeated cross-sectional data, I have appended 3 datasets stemming from d…
Subscribe to:
Post Comments (Atom)
0 Response to Explaining output from replace command
Post a Comment