r/stata • • 9d ago

I have vibecoded STATA and it's free

Thumbnail
github.com
72 Upvotes

Still doing a few minor updates, but yeah, it should work.

The Windows version will soon be uploaded

Edit:
Now both windows/mac are fully supported. And the update is done.

For user feedback, I may make a user report function, but maybe not because it would need an internet connection. So I may just write down my email for that in the program somewhere.


r/stata • • Feb 10 '23

Meta All Stata questions in a nutshell

Post image
63 Upvotes

r/stata • • Jan 31 '22

STATA cheat sheets

52 Upvotes

I just wanted to share a resource that has been incredibly helpful in my STATA journey: cheat sheets that cover most basic STATA commands. I've had this bookmarked for years and I still use it occasionally.

https://www.stata.com/bookstore/stata-cheat-sheets/

For STATA noobs: here's a free tutorial by the authors of the above cheat sheets.

https://geocenter.github.io/StataTraining/


r/stata • • Mar 26 '20

Code to load daily covid-19 data into Stata

49 Upvotes

I wrote some code to quickly load the latest state and international COVID-19 data into Stata. The U.S. data comes from covidtracking.com and the international data comes ecdc.europa.eu. These data are updated continuously, so each time the code is executed, it should load-in the latest available data.

Here's a link to download the do file from Google Drive:
https://drive.google.com/file/d/18RIpar2OAGaQyxsGrLOz_PBxoaUMzskw/view?usp=sharing
https://drive.google.com/file/d/1SLFdySD-6-fv9bzb0Rf731dJy9-LzuIa/view?usp=sharing

Alternatively, I've pasted it below. I hope it's helpful. Please let me know if you see any issues with it or have any questions:

Edit: As suggested by u/NotMitchelBade**, I converted the geoid variable for countries to 3-letters rather than 2-letters. States are still 2-letters. This way geoid uniquely identifies a geography. I also added a population variable which I had intended to include originally, but forgot. The original code is still available in the crossed-out link above.**

*covid19_data_20200327
*Loads daily U.S. State and International COVID-19 data into Stata

*Intermediate file list
loc file_list count_codes state_abbrv state_popul state_covid intnl_covid

*Paths
loc csv_count_codes "https://docs.google.com/spreadsheets/d/1qr1kqW62DRlaLiGdnmJqmLfPcVdy0fVmZaAh7Tat-uk/gviz/tq?tqx=out:csv&sheet=codes"
loc csv_state_abbrv	"https://docs.google.com/spreadsheets/d/1kuniBcV-3qMjQRH7nqTS9CXSapPFCSO5YACP0Y2kvmU/gviz/tq?tqx=out:csv&sheet=state_abbreviations"
loc csv_state_popul	"https://docs.google.com/spreadsheets/d/1kuniBcV-3qMjQRH7nqTS9CXSapPFCSO5YACP0Y2kvmU/gviz/tq?tqx=out:csv&sheet=cleaned"
loc csv_state_covid	"http://covidtracking.com/api/states/daily.csv"
loc csv_intnl_covid	"https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide-2020-03-25_0.csv"

*Load CSV files into Stata
tempfile tmp_csv `file_list'
foreach x of local file_list {
	copy "`csv_`x''" `tmp_csv', replace
	import delimited using `tmp_csv', clear varnames(1)
	save ``x'', replace	//Add additional macro quotes
}

*Combining and data
use `state_covid', clear

***Merging in state population and state name
merge m:1 state using `state_popul', assert(match) nogen
merge m:1 state using `state_abbrv', assert(match) nogen

***Appending with international data
label define note	1 "U.S. state data from covidtracking.com"				///
					2 "International data from ecdc.europa.eu"
gen note=1
append using `intnl_covid'
replace note=2 if note==.
label values note note

*Cleaning
gen _geoid		=cond(note==1,	state,geoid)
gen _name		=cond(note==1,	state_name,countriesandterritories)
gen _date		=cond(note==1,	date(string(date,"%15.0f"),"YMD"),	///
								date(daterep,"DMY")	)
gen _new_cases	=cond(note==1,	positiveincrease,cases)
gen _new_death	=cond(note==1,	deathincrease,deaths)
gen _new_hospt	=hospitalizedincrease		//Only available in state data
gen _new_tests	=totaltestresultsincrease	//Only available in state data
gen _pop_count	=cond(note==1,	population,pop_data2018)
keep _* note
rename _* *
format date %td
format pop_count %15.0fc
replace name=upper(subinstr(name," ","_",.))
order note, last
compress

*03/27/20 EDIT: Updating geoid to 3 characters for international data
merge m:1 geoid using "`count_codes'", keep(1 3)
assert _merge==3 if note==2
replace geoid=geoid3 if note==2
drop country geoid3 code _merge
isid geoid date
sort note geoid date

*Adding notes
note: original data downloaded from the covidtrackng and European Centre for Disease Prevention and Control websites"
note: data current as of `=c(current_date)'
note: http://covidtracking.com/api/states/daily.csv
note: https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide-2020-03-25_0.csv

r/stata • • Sep 27 '19 All-Seeing Upvote

Meta READ ME: How to best ask for help in /r/Stata

44 Upvotes

We are a relatively small community, but there are a good number of us here who look forward to assisting other community members with their Stata questions. We suggest the following guidelines when posting a help question to /r/Stata to maximize the number and quality of responses from our community members.

What to include in your question

  • A clear title, so that community members know very quickly if they are interested in or can answer your question.

  • A detailed overview of your current issue and what you are ultimately trying to achieve. There are often many ways you can get what you want - if responders understand why you are trying to do something, they may be able to help more.

  • Specific code that you have used in trying to solve your issue. Use Reddit's code formatting (4 spaces before text) for your Stata code.

  • Any error message(s) you have seen.

  • When asking questions that relate specifically to your data please include example data, preferably with variable (field) names identical to those in your data. Three to five lines of the data is usually sufficient to give community members an idea of the structure, a better understanding of your issues, and allow them to tailor their responses and example code.

How to include a data example in your question

  • We can understand your dataset only to the extent that you explain it clearly, and the best way to explain it is to show an example! One way to do this is by using the input function. See help input for details. Here is an example of code to input data using the input command:

``

input str20 name age str20 occupation income
"John Johnson" 27 "Carpenter" 23000
"Theresa Green" 54 "Lawyer" 100000
"Ed Wood" 60 "Director" 56000
"Caesar Blue" 33 "Police Officer" 48000
"Mr. Ed" 82 "Jockey" 39000'
end
  • Perhaps an even better way is to use he community-contributed command dataex, which makes it easy to give simple example datasets in postings. Usually a copy of 10 or so observations from your dataset is enough to show your problem. See help dataex for details (if you are not on Stata version 14.2 or higher, you will need to do ssc install dataex first). If your dataset is confidential, provide a fake example instead, so long as the data structure is the same.

  • You can also use one of Stata's own datasets (like the Auto data, accessed via sysuse auto) and adapt it to your problem.

What to do after you have posted a question

  • Provide follow-up on your post and respond to any secondary questions asked by other community members.

  • Tell community members which solutions worked (if any).

  • Thank community members who graciously volunteered their time and knowledge to assist you 😊

Speaking of, thank you /u/BOCfan for drafting the majority of this guide and /u/TruthUnTrenched for drafting the portion on dataex.


r/stata • • Sep 03 '19

Meta Hi /r/Stata, I'm your new mod. Help me make this place a better and more useful place!

43 Upvotes

Hi all - like the title says, I'm your new mod thanks to a request I made to the Reddit admins. The old mods have been inactive for over a year. I'm a sorta-long-time Stata user (5+ years now?), and while I'm not a wizard, I find myself helping far more than asking for help, so I figured I'd try to streamline my own and others' abilities to help.

I know this is a pretty lightly used sub, so I will leave this pinned as long as needed, but I humbly request all of your input. You can make suggestions for people I should make mods (feel free to nominate yourself), you can make suggestions for weekly threads, whatever! I will do what I can.


r/stata • • Jul 22 '26

Cost-quality tradeoff for LLMs writing Stata code

Post image
41 Upvotes

Based on Stata benchmark https://khaledeltokhy.com/benchmarks/


r/stata • • Apr 20 '21

Meta Stata 17 is out.

Thumbnail
stata.com
33 Upvotes

r/stata • • Jun 26 '19

Stata 16 Has Released!

31 Upvotes

Stata 16 has released with many new features! Highlights for me include Python integration, better validation methods, heckman's test and do-file autocompletion (like in R-Studio).

Here is a link to all the new features:

https://www.stata.com/new-in-stata/


r/stata • • Nov 01 '19

Is it though? ;)

Post image
29 Upvotes

r/stata • • Nov 02 '21

Thank you note

28 Upvotes

I just received an email that I passed my MSc and one of the notes written by my examiner was how impressed about the extent and speed that I have learned stata from basically scratch. I would like to thank all the lovely redditors here who helped me along the way. It’s not an understatement that I could not have done it without you guys. Thank you 😊

Grandmaster Mace Windu to my username: you are on this council and have been granted the rank of Master.


r/stata • • Oct 14 '25

What do you like about Stata?

25 Upvotes

I'm a first year grad student in public economics, and I'm having to learn Stata because of a class. So far, all my needs are covered by R and Python. But beyond course requirements and job market considerations, what are some good reasons to know Stata? What nice unique features does it have; what do miss about it when you work in other languages?


r/stata • • Feb 19 '21

You can Now Play The Oregon Trail in Stata!

Thumbnail
stata.com
24 Upvotes

r/stata • • Jun 02 '25

I'm a Python/R user, my boss uses STATA

23 Upvotes

Hi all!

I am a graduate student who works in Python or R. I'm working with my boss on a project and, for this part, I'll be doing all the analyses. The problem is that they work in STATA, which I have no knowledge of. They say I can work in Python or R as long as they can have a STATA file so they can check my work or run additional analyses on their own.

Given this, would it be better for me to work in R or Python? I'm willing to learn STATA, but I guess my question is whether R or Python is more easily transferable to STATA. I know that STATA has a strong Python integration, but to my knowledge that would require my boss to properly set up their environment, which I'm not sure if they'd know how to do.

I'm not doing anything too crazy (at least right now), mainly just EDA of means, SDs, with some tables and graphs. Later on I might do some word embeddings and things like that. Hopefully this question makes sense, thanks in advance!


r/stata • • Dec 21 '21

Deleting posts is antisocial

21 Upvotes

I've just had an experience I have had many times here. It was hard to find the state of play on a thread I had contributed to because the OP had deleted the original post.

This is clearly allowed on Reddit, but what gives?

Perhaps the OP felt embarrassed or humiliated by what they realized was a naive or silly question, or even at what they saw as flak. No one should feel that way (unless their question violated the advertised Rules) and anyway the cryptic identifiers people typically use should cut any such feeling to a bare minimum.

Perhaps the OP is in what they think is a competitive situation, so that (say) they're working on an assignment and they want to have an edge on their classmates, or whatever. That is petty, even if teachers are marking on a curve or according to a quota.

The point of this sub-Reddit I see as being much more than that someone needs help and other people may be willing to give them some time and share some expertise and experience. It's also that yet other people may find a thread interesting and useful.

Behavior like this tempts me to name and shame people who do it, but I guess that would be thought not nice. It is also not nice to waste my (our) time if you are going to do this.


r/stata • • Apr 25 '23

Stata 18 is here

20 Upvotes

Stata 18 is here! Here’s a look at some of what we’ve introduced:

â—† Bayesian model averaging â—† Causal mediation analysis â—† All-new graph style â—† Tables of descriptive statistics â—† Heterogeneous DID â—† And so much more

Explore all the new features → stata.com/new-in-stata

Copy pasted from: https://twitter.com/Stata/status/1650893527356768257?s=20


r/stata • • Sep 18 '20

Slides (etc.) from the 2020 Stata Conference

Thumbnail
stata.com
19 Upvotes

r/stata • • Feb 12 '22

Low quality posts on /r/Stata recently

18 Upvotes

I have to he honest, I'm getting really turned off by the barrage of low quality posts recently on this subreddit. To me, it seems to be the same heteroskedasticity question yet again, or question that is readily answered with a Google query, or a post with nearly zero details that is impossible to answer, or someone wanting us to do their homework. I do like this community and want to see it thrive. Any suggestions on how we might improve post quality?


r/stata • • Jul 12 '21

Need to Learn Stata in 6 weeks.

18 Upvotes

This fall I’m working on some research on campus and my advisor told me to learn some STATA before classes start in August. What’s the best way to learn the basics? Also, he told me that I should focus on issues around data and variable manipulations. Given my undergrad status I don’t think I will have to deal with very complex data but I want to feel comfortable.


r/stata • • May 03 '21

Awesome Article on Estout

18 Upvotes

Found this super helpful and straightforward article explaining how to work with estout to create correlation matrices.

https://thedatahall.com/reporting-publication-style-correlation-tables-in-stata/

Not sure if I'm allowed to post things that aren't questions but I figured you all would enjoy some quality stata content.


r/stata • • Sep 06 '24

Best ways to learn STATA, from a beginner level, in a short time?

16 Upvotes

Starting an internship where STATA would be needed. Need to learn a lot, but quick. Driven and ready to commit to hard work. Please send in all suggestions and tips. Thanks.


r/stata • • Jul 20 '19

My Stata channel on Youtube

16 Upvotes

Hi all,

I launched a new Youtube channel the other day called SATAstic!, where I want to regularly upload videos to share stata tricks that I've learned over the past years of using stata in academia, from basic commands to more advanced .do-file-programming. Here's the link: www.youtube.com/channel/UCa3qMXCWBg9hA11aRuRCrCQ/

I want to be different from other channels by making this an interactive experience, with viewers asking me lots of questions, and I'll do my best to answer them in the videos. I'm thinking of maybe even answering questions using the user's dataset (if they want to share of course), or extracts thereof.

So: Please drop by, let me know what you think, ask away!

PS: Yes, I know, this post is shameless self-promotion! I've messaged a mod about whether I could advertise here, but I haven't received an answer. Then again, I don't plan to make money with this, and it's a hobby project for me, so I don't see harm in advertising to my possible audience.


r/stata • • Feb 26 '26

Teaching Stata to students with limited independent problem solving abilities....

15 Upvotes

Hi all,

I teach undergraduates and part of my current course involves using stata for data analysis. I'm fairly new to stata myself, as I usually use a different software, but I've grasped enough of it to be able to teach students how to use it.

However, I'm finding it difficult because my students seem to display very little independent problem solving abilities. They get frustrated when code doesn't run and don't seem to have the ability (or desire) to think about why they're getting error messages. They need hand holding through basic tasks.

So, I'm starting to rethink how I teach the class for next semester. I think I need more activities for them to build up their problem solving abilities to troubleshoot their own issues in stata. Does anybody have any ideas on resources how I can help them do this?

I was thinking some activities like comparing two sets of do-files, one where the code works perfectly and the other where the code has errors. They have to spot and fix the errors in the second set of code.


r/stata • • Oct 31 '25

NEED HELP- STATA License

15 Upvotes

Hi Guys

I am a Master's student and my uni is not providing stata for us. For some research work I need to use Stata and its too costly, also I am using a mac. Can't figure out what to do.
Please help.

Thank you