Johan Osterberg - Product Engineer

Johan Osterberg

Written by Johan Osterberg who lives and works in Gothenburg, Sweden as a developer specialized in e-commerce. Connect with me on Linkedin

Anova in Stata

July 27, 2019

Doing analysis of variance (often refered to as ANOVA ) in Stata is easy. Let’s begin by finding a suitable dependent variable which…

Calculating cumulative contribution in Excel

June 15, 2019

In this example again we’ll look at some order data: Here we see a table of orders, grand total for each order and two as of yet empty…

Working with datatypes in Stata

June 13, 2019

For this tutorial I have imported data consisting of e-commerce orders from an Excel file into Stata and then saved it as a dataset…

Basic regression in Stata 2

June 11, 2019

In the previous post we looked at regression in Stata by exploring two commands, correlate and pwcorr . In this brief post we’ll…

Basic regression in Stata 1

June 10, 2019

In this post we’ll briefly be looking at regression in Stata by exploring two commands, correlate and pwcorr . The difference between…

Calculating confidence interval in Excel

June 09, 2019

This post describes how to calculate a confidence interval on a sample set of more than 30 observations. For this example let’s start out…

One sample t-test in SPSS

May 17, 2019

Running a one-sample t-test in SPSS is very straight forward. For the purpose of this example, let’s use the demo.sav training dataset…

Handling missing values in Stata

May 16, 2019

Effectively handling missing data in Stata largely comes down to dealing with how Stata treats missing values to begin with. Stata treats…

Chi-square test in Stata

May 13, 2019

In this tutorial we’ll look at performing a chi-square test in Stata . We’ll use the nlsw88 dataset for this, so In order to perform…

Chi-square test in SPSS

May 12, 2019

In this quick tutorial we’ll look at performing a chi-square test on a single sample. More specifically, we’ll look into performing a…

Looping in Stata

May 10, 2019

Looping in Stata is mainly achieved by use of the foreach command. Using the nlsw88 dataset we’ll generate a new variable with…

Working with strings in Stata

May 07, 2019

The two main commands used in Stata when working with strings are tostring , destring , encode and decode . For this example, let’s…

Binary variables in Stata

April 29, 2019

Creating binary variables in Stata is useful for many purposes, for example if you quickly need to get an overview of a variable with a…

Getting started with source{d} on Windows

April 25, 2019

This post will go through the basics of setting up Source{d} on Windows.

Combining datasets in Stata

April 23, 2019

If you have two (or more) datasets that you want to combine, this can be achieved by using either the append or merge commands. The…

Dropping values in Stata

April 22, 2019

Dropping values in Stata is achieved by the drop command. Let’s load the auto training dataset and create a new variable: That’s…

Generating variables in Stata

April 19, 2019

Generating new variables in Stata is mainly achieved by use of the gen command. The simplest way to use the is by appending the newvar…

Distributional analysis in Stata

April 17, 2019

When working with a continous variable such as income it is often needed to get an overview its distributional properties. Let’s look at…

Hypothesis test in SPSS

April 16, 2019

For the purpose of this tutorial, I’m gonna be using the sample data set demo.sav , available under installdir/IBM/SPSS/Statistics…

Recoding variables in Stata

April 15, 2019

Recoding variables in Stata is very simple. It is useful in many scenarios, for instance where you would want to merge a variable…

Basic summary commands in Stata

April 13, 2019

Some of the most basic utility commands to summarize, describe and get an overview of your data are When opening a new dataset it’s crucial…

Importing Excel files in Stata

April 13, 2019

In this short post we’ll look at importing data from an Excel file into Stata . For this example we’ll use some training data from another…

Using do-files in Stata

April 12, 2019

Using do-files (a text file with the .do extension) is the preferred way of working in Stata . They are simply text files containing…

Transforming log files in Stata

April 11, 2019

In a previous post we looked at working with log files in Stata . As discussed in that post, Stata files take the file extenstion .smcl…

Working with log files in Stata

April 11, 2019

Log files in Stata can be useful if you want to keep track of your work over time, simply because it enables you to save your session for…

Tabulating and custom tables in Stata

April 09, 2019

Tabulating and summarizing are common activities when exploring a new dataset. Tabulating can be useful when laying out categorical…

Browse and edit data in Stata

April 03, 2019

In order to browse or edit data cells in Stata, the browse and edit commands are the most commonly used. The difference between those…

Getting started with Stata

March 29, 2019

Stata is a powerful statistics package, that has been around since the mid ‘80-s or so. And it sure looks like it! That was my first…