Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
40 views

I am fitting a Cox proportional hazards model in Stata and checking the proportional hazards (PH) assumption using estat phtest. Here is how I set up my survival data: stset time, failure(event) ...
Sourav Roy's user avatar
1 vote
2 answers
51 views

I wrote a program and gave its syntax the optional option nosort. It's behaving strangely and my hunch is that it might be a reserved word of some kind. Here is some example code. Two programs that do ...
Moritz Poll's user avatar
0 votes
0 answers
32 views

I am working with survey data and want to compute the survey-weighted mean of age at sexual initiation by year of birth (yob) cohort, along with standard errors and 95% confidence intervals. I've ...
Alonso Quijano's user avatar
0 votes
0 answers
49 views

As the title, I need the fallback settings of the fonts in Stata 17's do-editor. Is that possible? I found that there is only one font could be set in the right-click preferences: I want fontA for ...
Explorer's user avatar
  • 111
0 votes
0 answers
131 views

I'd like to be able to store and save the "Post_avg" regression output from Stata's csdid command so that I can automate the production of regression tables. When I try **egen gvar = csgvar(...
Hannah Sayre's user avatar
2 votes
1 answer
108 views

In Stata, how can I force the graph to stop displaying after a certain point on the x-axis? For instance, say that I have: sysuse auto2, clear gen mid = (price + weight)/2 gen n = _n twoway /// ...
bill999's user avatar
  • 2,580
0 votes
0 answers
24 views

Code like viewsource ivregress.ado allows us to see the implementation of the command in Stata. How can I access the implementation of something like ivregress postestimation/estat endog?
Christoph Hanck's user avatar
-2 votes
1 answer
100 views

I am trying to create a loop in Stata so that I can add multiple variables for creating mean_var and median_var. However, this data isn't creating any variables; the collapsed_file is the same as my ...
Shivam Tawari's user avatar
0 votes
0 answers
61 views

I want to estimate (the Greek characters are coefficients to be estimated): where D_{it}^d are dummy variables (=0 or 1), and {\theta_i}_i,delta are to be estimated. i can be large, so there are a ...
Nameless's user avatar
  • 165
0 votes
1 answer
67 views

I created this code that works correctly in Stata 17, but when I try to replicate and run it in Stata 16, it produces errors. The main issue is that it only generates the table considering the first ...
Francisco olivero's user avatar
0 votes
0 answers
28 views

Please help me, I am using Stata for LM test and the code is as follows: spatdiag,weights(x1) however, the Lagrange multiplier and Robust Lagrange multiplier are displayed in scientific notation due ...
user19560886's user avatar
-1 votes
1 answer
91 views

I have 4 different variables in my raw data (all starting with the prefix raw_), followed by combinations of hours/money and school/social. In my real data, I have many more options for each value of ...
a_todd12's user avatar
  • 664
0 votes
1 answer
54 views

Stata receives my commands for the justification of a string variable named make on the right (format make %18s) and left (format make %-18s). This reception results from the ‘properties’ table. ...
Riccardo Tucci's user avatar
0 votes
0 answers
99 views

I am writing a dofile (Stata script) on VS Code, and since it's pretty long, I would like to divide it into different sections so that I can easily navigate the script and quickly get to the lines I ...
Vincenzoalfano's user avatar
0 votes
1 answer
53 views

I have one string variable which has 4 characters: the first two are the hours and the second two are the minutes. How can I split that variable into two variables, one for the hours and the other for ...
Pepe Hidalgo's user avatar
0 votes
1 answer
117 views

I am new to using Stata and I am currently trying to learn how to better organize the output of my Stata scripts for easier reading and presentation. I've seen some outputs that have visually distinct ...
Dimon 999999's user avatar
0 votes
1 answer
91 views

I've got this IV specification that I would like to plot to have the marginal effect of x1 on y as a function of x2: ivreg2 y= (x1 x1#x2 = z1 z1#x2), endog(x1 x1#x2) with x1 and x2 continuous and z1 ...
redha's user avatar
  • 3
0 votes
1 answer
57 views

I'm trying to write an ado file that return my matrix prog drop EM program define EM, eclass matrix P0 = (.9, 0.09,0.01 \ 0.1, 0.8, 0.1 \ 0.05, 0.15, 0.8) return P0 end EM The error I got is invalid ...
jgr's user avatar
  • 129
0 votes
1 answer
149 views

I want to create a table for Excel, based on numbers from Stata. A cell might have a number and stars (indicating statistical significance), such as "0.15***". Minimal example attempts in ...
Nameless's user avatar
  • 165
1 vote
1 answer
227 views

The title says it all. After running a diff-in-diff in Stata with "xtdidregress", I am then creating a graph testing the parallel trends assumption using the command "estat trendplots&...
cyberalcito's user avatar
1 vote
0 answers
82 views

I'm trying to load data into Stata from a SQL database hosted in Databricks, via the odbc load command. For part of the query I need to declare and run a small Python function (Databricks SQL, or at ...
rsandler's user avatar
  • 210
0 votes
0 answers
996 views

I run a staggered DiD regression with the Stata command did_multiplegt_dyn by De Chaisemartin, C., & d'Haultfoeuille, X. (2024). Without control vars the command runs # Comand without controls ...
mf_uni's user avatar
  • 3
0 votes
1 answer
32 views

I have successfully used lagged values in the "IF" section of a replace. How do I specify a range instead of each individual lagged variables. Iteration is not an option. I have ~...
Michael Bromiley's user avatar
1 vote
1 answer
239 views

I'm facing an issue with replicating the results of a basic logistic regression model in R. The model was originally run in Stata. The issue is that all of my odds ratios (and their underlying ...
tomatosauce's user avatar
1 vote
1 answer
117 views

I have a table with the first column case IDs and the following columns matched control IDs. Some control IDs will be paired to more than one case ID. There's an index date which corresponds to all ...
Emma's user avatar
  • 11

1
2 3 4 5
94