Home > Data Services > Catalog . Restricted Data . Census . ACS

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

KnowledgeBase
Common questions and answers.

Resources
Entire collection of data resources.


Latest Data News

RSS Feed icon

Tools: Data as Text

More fun with names

Counting Same-Sex Couples

The Antidote for “Anecdata”: A Little Science Can Separate Data Privacy Facts from Folklore

Big Data: NYC Taxi Cab Trips

Data Services Knowledge Base

Q:  

How should I define my variables in Stata? Specifically, what are the options for character, integers and real numbers?

A:  

The following is a link to a quick reference for data types in Stata:

http://www.stata.com/help.cgi?datatypes

Variables can contain numbers or strings. Numeric variables can be stored as integers (bytes, integers, or longs) or floating point (float or double). These types differ in the range of precision of the values they can hold. Stata encourages you to record your data as efficiently as possible, so if you have dummy variables (0,1) it makes sense to define them as bytes as this takes the least amount of space in memory.

String variables can have varying lengths up to 244 characters (str#). The length of the string is indicated by the # key, str6 vs str20.

Annotated Resources:

Direct Links:

Related Question Groups: