Two arguments in the "rank" function of egen
Hi friends, I have data about parents and their children, it is build like that: id_parent - parent identifier birth_year - the birth year of every one of his children id_child - child identifier So...
View ArticleStata Code for "Regression and Other Stories" and...
I had a question for this group regarding Stata examples for the regression text, "Regression and Other Stories" by Gelman, Hill and Vehtari. Gelman, A., Hill, J., & Vehtari, A. (2020). Regression...
View ArticleCreate pre-post timing variable based on max sequence
Hi all, I have some time-series data of children and various "statuses" of their father, which is often missing but, when valid, will take values 0-5 and almost always start at 0 and escalate in...
View ArticleExtending the number of string characters when reshaping from wide to long...
Hi Stata Team, Here is my command: foreach var of varlist Tech* { local Tech_nr: subinstr local var "Tech" "" label define Tech_label `Tech_nr' "`:variable label `var''", add } The issue is this. After...
View ArticleReporting results from xtdidregress
Hello, I am running a DiD with panel data and have been using the xtdidregress command (one treatment administered once). I am debating which results to report in a paper. I am able to use...
View ArticleHow to Export Stata Database to Excel with Custom Numeric Formatting
Good afternoon, I would like to know if there is a direct command in Stata that allows me to export an entire database to Excel with a specific numeric format (ideally I use export excel) . Ideally, I...
View Articleinitial values not feasible r(1400);
Dear Statalist, I'm trying to run a continuously updating GMM estimator (CUE), after some digging I was pointing towards the community command xtdpdgmm. Regardless of how much I adjust my model by...
View ArticleDiD: Units switch in and out of treatment
Hello StataList, first time poster, long time admirer of your work. I am running diff-in-diffs with panel data using xtdidregress (Stata 18), and along with the output I recieve the following note:...
View ArticleOrganizing coefplot coefficients by variable rather than model?
Hi everyone, I was wondering if it was possible to organize coefficients in coefplot by model rather than variable. Take the example produced by the code below. In descending order from the top of the...
View ArticleStata crashes opening data editor
I've been having a problem with Stata 16.1 in Ubuntu 24.04. It crashes when opening the data editor. Other functions seem to work well
View ArticleHow can I perform regression of Y on different quantiles of X?
Quantile regression typically examines how the independent variable X affects different quantiles of Y, but I would like to investigate the quantiles of the independent variable X instead. Is there a...
View ArticleLabel define where labels differ for same values of a variable by group
Dear all, I want rel_year_nonneg to have labels as the values of display_rel_year_nonneg, which labmask is unable to do. Basically, I want labels of rel_year_nonng to differ by cohort. I can't use "if"...
View ArticleFixed-Effects (FE) Panel Regression Model with 'reg' 'reghdfe'
For my assignment, my sample dataset structure is : i (user:1-500) - j (platform=0/1) - t (time:1-24). Number of obs 23,450 (not perfectly structured) I was going to estimate the impact using...
View ArticleEstimating hospital mortality with recurring patients and duplicates
Dear all, I have a data management issue in an epidemiological study where the goal is to estimate mortality rate in a hospital across different time periods, specifically from May to December for the...
View Articleon implementing 2SRI/CF through Prof Terza's code - Matrix multiplication is...
Hi I am working with DHS data on implementing the Control Function approach following Prof Terza's guide. I use STATA 17. Endogenous regressor: Women's Occupation Instrument: Cluster Average of Women's...
View Articledtable with Proportions and their 95% Confidence Intervals for categorical...
Greetings, I would want generate a dtable that displays the proportion and it's 95% Confidence Intervals of the prorpotions for each categorical variable: Code: * Example generated by -dataex-. For...
View ArticleClassifying panel data by income each year of the period or just the last...
Hello everyone, I have panel data from 52 countries and 19 periods (1996 to 2014). I want to classify the dataset by income using GNI per capita based on WB guidelines ($1,045 - $4,095 - $12,695...
View ArticleSpmap command
Hello, below is my main dataset used for creating a map using the 'spmap' command in STATA. Code: * Example generated by -dataex-. For more info, type help dataex clear input float(ward district) 25744...
View ArticleSearch/replace not working as expected when selecting a region to apply s/r to
I have just upgraded to version 18. I have discovered a maddening feature of the text editor that didn't exist before. I'm wondering if this is a feature or a bug. Here's the issue using a very simple...
View ArticleHelp with subtracting more than one disease code from string variables
I have a variable called "disease" that is of type string and that contains at the beginning the disease code, for example K00.1 but then it has the description and in some cases, it appears more than...
View Article