Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reprun: Improve handling of sorting when command uses by #60

Open
bbdaniels opened this issue Jun 27, 2024 · 3 comments
Open

reprun: Improve handling of sorting when command uses by #60

bbdaniels opened this issue Jun 27, 2024 · 3 comments
Assignees
Labels
reprun Relates to reprun resolved but unpublished Solution submitted but unreleased wontfix This will not be worked on

Comments

@bbdaniels
Copy link
Contributor

No description provided.

@bbdaniels bbdaniels self-assigned this Jun 27, 2024
@bbdaniels bbdaniels added reprun Relates to reprun enhancement New feature or request labels Jun 27, 2024
@ankritisingh
Copy link
Contributor

sysuse census, clear

gen check = 1

bys region: egen assigned 		= total(check)
bys region: egen treated_tot 	= total(check & region != 1)

recode region (1 = 2) (2 = 1) (3 = 4) (4 = 3)

* estpose is not flagged without recode (also nto sure why they used recode)
estpost tabstat assigned, statistics(mean) by(region) nototal

replace region = . if region == 1

* this is not flagged if the obs are not missing
bys region: sum pop


Screenshot 2024-06-27 at 6 07 05 PM
Screenshot 2024-06-27 at 6 07 14 PM

@bbdaniels
Copy link
Contributor Author

I don't think this is solvable in a general case, especially when by is an option; I don't believe you can avoid the indeterminate within-group sort there. I have added a note on it in the manuscript. But I will continue to think about it...

@bbdaniels
Copy link
Contributor Author

I had a good discussion about this at Stata Conference and they agreed it was likely to be unsolvable. In addition when bys is used in a user written command that leaves the data out of order it may or may not even be detectable by any kind of syntax checking. On the other hand, the flag is appropriate since unstable sorting will in fact lead to instability, and it is good to detect that even if there is no downstream consequence. So I advise to mark as wontfix and to write this out in documentation and in the manuscript.

@ankritisingh ankritisingh added wontfix This will not be worked on and removed enhancement New feature or request labels Sep 6, 2024
ankritisingh added a commit that referenced this issue Sep 6, 2024
@kbjarkefur kbjarkefur added the resolved but unpublished Solution submitted but unreleased label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprun Relates to reprun resolved but unpublished Solution submitted but unreleased wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants