Convert String Variables to Numeric in Stata
In this post, I show how to convert string variables to numeric in Stata. String variables are shown in red . If a numeric variable is stored as a string variable in Stata, we have several ways to convert them to numeric variables. Let's start with the destring command first. 1. The destring command The [...]
Quick Table for Renaming Variables in Stata
Renaming a single variableRenaming a single variable is pretty simple in Stata. Assume that we have the following variables in our data set. date symbol returnsIf we wish to rename the returns variable to just ret, then the code will berename returns retRenaming many variablesWe can rename many variables using the "rename group" features of the [...]
asrol’s Options | Stata Package for rolling window statistics
asrol's Options asrol has one required option and 8 optional options: Details are given below: 1. stat() Option stat is used to specify required statistics. Version 4.0 or higher of asrol supports multiple statistics for multiple variables. The following statistics are allowed; Option Details sd Estimates the standard deviation of non-missing values mean [...]
Using the bysort prefix with tab commands in asdoc | Stata
Recently, Scott Siegal asked for the possibility of adding the bysort prefix with tabulate, tab, tab1, and tab2 commands to asdoc. Honoring his request, I have added the bysort support to asdoc. The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter. net [...]
What is a Python Dictionary
Python Dictionary¶ Dictionary is a method in which data is stored in pairs of keys and values. These are also called Associative Arrays in other programming languages. What is key-value pair?¶ key is a unique identifier for a given record. Values are data stored in that identifier. For example, Let [...]
Getting Started with Data Visualization in Python Pandas
DOWNLOAD DATASETS¶ To download the datasets used in this tutorial, pleas see the following links 1. gapminder.tsv 2. pew.csv 3. billboard.csv 4. ebola.csv 5. tips.csv TED Talk Dataset Excercises¶ In [5]: # Change directory In [6]: cd "D:\Dropbox\CLASSES\Data Science for Finance\Python\Lecture 1 - Assignment" D:\Dropbox\CLASSES\Data Science for Finance\Python\Lecture 1 - Assignment In [7]: import pandas as pd In [8]: ted [...]