Asjad Naqvi Profile picture
Sep 14 38 tweets 15 min read
A 🧵 to consolidate the #Statatip posts from the past three years! Bookmark these.

If you want to read them in detail, have a look at the Awesome @Stata tips collection:

medium.com/the-stata-guid…

Its updated every 2-3 months or so. Many tips below 👇
replacing bad file imports with column headers in the first row. This of course has been solved in the more recent "import delimited" command.

#Statatip

Check for program updates regularly! You'd be surprised how many updates user-written programs receive.

Acutally type this right now:

ado update, update

#Statatip

Do you know that you can swap languages and decimals/commas in Stata if you are working across multiple languages 🤯

For example, you can have labels in English and a second set in German/Spanish/French etc etc. and swap between the two!

#Statatip

An organizational tip:
do the dofiles in the master file.

#Statatip

Once you manage to reshape wide or long, you can easily swap back and forth:

#Statatip

Programming your own ado and don't know where to start?

Look this up and go from there:

value labels can be modified and replaced. But did you know they could be stripped? 🤯

You can add notes to datasets and variables. It used to be a norm back in the days to embed meta data in the files

There are lots of great packages that allow you access databases. "freduse" is one of them. You can also "import fred" if you have the keys:

We are all used to writing clear at the beginning of dofiles. But there are many types of clears...

In the good old Stata days, directly plotting scatter in ASCII was the way to visualize data.

You can still check out this retro graph 😎

A useful tip: define labels that are used multiple times only once!

This is one of those tips that takes years to internalize

egen xx = sum(yy) is total
gen xx = sum(yy) is running total

🤯🤯

Working with shape files? Before maps became easier to plot, there was some documentation available to import GIS data.

#Statatip

Finding variables is super easy with "lookfor" and "ds".
I have also posted about them multiple times.

#Statatip

We can easily reorganize the order of legend entries in Stata graphs

#Statatip

This tip first introduced by @JanKabatek was life changing. Don't load massive datasets. Stata can read the variable list without making your memory scream. You can then decide what you want to load.

#Statatip

Finalized a code chunk and don't want lines scrolling across your screen. Make code chunks quiet:

Also the opposite of quiet is "noisily", in case you still want to display something from the "quiet" block.

#Statatip

Generating variables is not as trivial as it looks. You can generate the same thing in many different ways.

#Statatip

Want to make your Stata datafiles secure. Use the the extremely rare feature of data signatures. Check out "help datasig"

#Statatip

An ultimate #Statatip is to type "query". ALL your presets in one place! 🤯

PS: Don't modify stuff you don't know about. Check out their help files etc.

You can collapse code blocks! Those curly brackets do a long way.

A secret summary statistics command: "inspect"

Also comes with an ASCII bar graph 😎

Plotting multiple graphs?! You can tab them together or give them separate windows!

This is more of a small code for generating the time and panel IDs for panel datasets. Now fully incorporated in the DiD repo!

Indent your code! And turn on the indentation guides!!

Quickly visualize Mata matrices. You can also use heatplot to visualize Stata matrices.

Just want to increase the labels on the axes? Use this 👇

Sometimes live syncing on the cloud can cause errors. You can "sleep" Stata for a breather 😉

Lots of gems in the "undocumented" section of Stata:

You can execute some stuff in alphabetical order:

Pimp up your Stata graphs by adding text boxes inside

You can make Stata less or more nicer 😏

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Asjad Naqvi

Asjad Naqvi Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @AsjadNaqvi

Apr 17, 2020
What can be done about #COVID19 in #Pakistan? After having worked on this country esp. #Punjab for the past 15 years, let's start with what we KNOW from a data perspective GIVEN there is little testing and little enforcement and just the size of the country of 220 million 1/n...
Taking a composite of satellite images, latest census, and cell phone data, and using machine learning we now know exactly what the population landscape looks like. Its highly complex. My home town, Lahore, seen as the large red color, is just 12 million alone 2/n...
This information can be coded into distinct settlements and mapped onto censuses to get a more accurate picture of population distributions and education structures. This has already been achieved via brute force matching, statistical matching, and machine learning...3/n...
Read 10 tweets
Apr 13, 2020
#COVID19 in #Europe thread. Below we see the trends for reported cases and deaths per 1,000,000 pop (pop normalization is imp for comparison). Belgium, France, UK, Sweden, Ireland have started showing exponential growth 1/n.... @IIASAVienna @DianaUrge @IIASA_Library
If we look at the reported cases and deaths for each country, again normalized by population, then one can see the south to north wave. Northern countries are still behind the curve and could see rises in the next few days. see next graph for doubling time... 2/n...
If we sort the countries by doubling time of reported cases / 1m pop relative to past 10 days, then Austria is the clear winner here. Slowing down reported cases is not the same as slowing down deaths. Countries under 10 days are at critical points. 3/n.@DianaUrge @IIASAVienna
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(