or reproduction includes attribution to both (1) the author and (2) the Stata Journal Keywords: pr0016, cond(), functions, if command, if qualifier, generate, replace or both string, and—depending on context—variables or single values There are, not surprisingly, other ways of carrying out multiple categorization If
Previous PDF | Next PDF |
[PDF] Depending on conditions: a tutorial on the cond () function
or reproduction includes attribution to both (1) the author and (2) the Stata Journal Keywords: pr0016, cond(), functions, if command, if qualifier, generate, replace or both string, and—depending on context—variables or single values There are, not surprisingly, other ways of carrying out multiple categorization If
[PDF] 11 Creating new variables - Stata
replace for replacing the values of an existing variable It may not be abbreviated because it alters existing data and hence can be considered dangerous The
[PDF] 13 Functions and expressions - Stata
Multiple-equation models Generating lags and leads 13 9 Indicator values for levels of factor variables 13 10 1 Generating lags, leads, and differences
[PDF] Title Description Quick start - Stata
recode changes the values of numeric variables according to the rules specified If generate() is not specified, the input variables are overwritten; values
[PDF] Tabulation of Multiple Responses - Stata
width of response labels, turn on/off labels/names/values, turn on/off breaking wide tables, suppress freq table, □ Misc: generate new indicator variables,
[PDF] ECO – Stata How-to: Conditions, subsetting data - Toronto: Economics
16 sept 2019 · Advanced: Creating a dummy variable based on a condition 5 9 Advanced: Applying a command to distinct groups of observations using
[PDF] Stata: Recode and Replace - Population Survey Analysis
Topics: Generating new variables in Stata The general process to generating a new variable is simple First multiple replace statements for each new
[PDF] Speaking Stata: On structure and shape: the case of multiple
graphics, indicator variables, multiple responses, reshape, split, string functions, tabulations values other than zero before we generate a new variable
[PDF] STATA FUNDAMENTALS - Middlebury
The varlist tells Stata what variables to take this action on This is Example: Generating dummy variables that incorporate multiple values of a categorical
[PDF] Useful Stata Commands for Longitudinal Data Analysis
Be careful with missing values: == +∞, this might produce unwanted results For instance, if you want to group a variable X, this is what you get gen Xgrouped
[PDF] state primary nomination paper
[PDF] state representative district map
[PDF] state teaching certificate
[PDF] state the characteristics of oral language
[PDF] states that recognize federal tax treaties
[PDF] static method in java
[PDF] static utility methods in java
[PDF] station france bleu lorraine nancy
[PDF] station radio france bleu paris
[PDF] stationnement gratuit lille
[PDF] statista food delivery industry
[PDF] statistical report sample pdf
[PDF] statistics canada international students
[PDF] statistics class 10 full chapter
Give to AgEcon Search
This document is discoverable and free to researchers across the globe due to the work of AgEcon Search.Help ensure our sustainability.
AgEcon Search
http://ageconsearch.umn.edu aesearch@umn.eduPapers downloaded from AgEcon Search may be used for non-commercial purposes and personal study only.
No other use, including posting to another Internet site, is permitted without permission from the copyright
owner (not AgEcon Search), or as allowed under the provisions of Fair Use, U.S. Copyright Act, Title 17 U.S.C.
The Stata Journal
Editor
H. Joseph Newton
Department of Statistics
Texas A & M University
College Station, Texas 77843
979-845-3142; FAX 979-845-3144
jnewton@stata-journal.comEditorNicholas J. Cox
Geography Department
Durham University
South Road
Durham City DH1 3LE UK
n.j.cox@stata-journal.comAssociate Editors
Christopher Baum
Boston College
Rino Bellocco
Karolinska Institutet
David Clayton
Cambridge Inst. for Medical Research
Mario A. Cleves
Univ. of Arkansas for Medical Sciences
William D. Dupont
Vanderbilt University
Charles Franklin
University of Wisconsin, Madison
Joanne M. Garrett
University of North Carolina
Allan Gregory
Queen"s University
James Hardin
University of South Carolina
Ben Jann
ETH Zurich, Switzerland
Stephen Jenkins
University of Essex
Ulrich Kohler
WZB, Berlin
Jens Lauritsen
Odense University HospitalStanley Lemeshow
Ohio State University
J. Scott Long
Indiana University
Thomas Lumley
University of Washington, Seattle
Roger Newson
King"s College, London
Marcello Pagano
Harvard School of Public Health
Sophia Rabe-Hesketh
University of California, Berkeley
J. Patrick Royston
MRC Clinical Trials Unit, London
Philip Ryan
University of Adelaide
Mark E. Schaffer
Heriot-Watt University, Edinburgh
Jeroen Weesie
Utrecht University
Nicholas J. G. Winter
Cornell University
JeffreyWo oldridge
Michigan State University
Stata Press Production ManagerLisa GilmoreCopyright Statement:The Stata Journal and the contents of the supporting files (programs, datasets, and
help files) are copyright c?by StataCorp LP. The contents of the supporting files (programs, datasets, andhelp files) may be copied or reproduced by any means whatsoever, in whole or in part, as long as any copy
or reproduction includes attribution to both (1) the author and (2) the Stata Journal.The articles appearing in the Stata Journal may be copied or reproduced as printed copies, in whole or in part,
as long as any copy or reproduction includes attribution to both (1) the author and (2) the Stata Journal.
Written permission must be obtained from StataCorp if you wish to make electronic copies of the insertions.
This precludes placing electronic copies of the Stata Journal, in whole or in part, on publicly accessible web
sites, fileservers, or other locations where the copy may be accessed by anyone other than the subscriber.
Users of any of the software, ideas, data, or other materials published in the Stata Journal or the supporting
files understand that such use is made without warranty of any kind, by either the Stata Journal, the author,
or StataCorp. In particular, there is no warranty of fitness of purpose or merchantability, nor for special,
incidental, or consequential damages such as loss of profits. The purpose of the Stata Journal is to promote
free communication among Stata users.TheStata Journal, electronic version (ISSN 1536-8734) is a publication of Stata Press, and Stata is a registered
trademark of StataCorp LP.The Stata Journal (2005)
5, Number 3, pp. 413-420
Depending on conditions: a tutorial on the
cond() functionDavid Kantor
kantor.d@att.netNicholas J. CoxDurham University,
UK n.j.cox@durham.ac.uk Abstract.This is a tutorial on thecond()function, giving explanations and examples and assessing its advantages and limitations. Keywords:pr0016, cond(), functions, if command, if qualifier, generate, replace1 Introduction Stata functions, like functions in any similar language, fall on a continuum, from those you know you want to those you do not know you need. If you want a logarithm, a square root, or some probability function, the only small difficulty is likely to be checking the exact syntax Stata uses: Islog()equivalent toln()orlog10()?Howdo I get tail probabilities for a Gaussian? What is more problematic is finding out about functions that might be useful and should thus be added to your personal toolkit. The help files and the manual entry [D]functionsare admirably terse and precise but lack detailed examples making clear how functions can be exploited in practice. In several cases, the issue is not so much understanding the definition, but more appreciating how a particular function might be helpful in the future.The function
cond()is a case in point. The online help gives its formal definition. Here only the simpler of the two forms allowed is examined. In this tutorial, we will not ever get to the more complicated form, as we can do plenty without it. cond(x,a,b)returnsaifxevaluates to true (not 0) andbifxevaluates to false (0). In abstraction, the idea is that of producing different results-aorb-depending on whether a specified condition-x-is true or false. The results can be both numeric or both string, and-depending on context-variables or single values. As with many formal definitions, this may not impart a strong sense of precisely how usefulcond() could be. The purpose of this tutorial is to provide such a sense. On the way, we will make comparisons with how else various problems might be solved.2 Simple examples Let us make that definition concrete immediately with some simple examples.1. Ifaandbare numeric variables,cond(a > b, a, b)returns the larger ofaand
b. Given a little knowledge of Stata"s functions, your reaction is likely to be thatc?2005 StataCorp LPpr0016