Stata提示152:if和if:何时使用if限定符以及何时使用if命令

IF 3.2 2区 数学 Q1 SOCIAL SCIENCES, MATHEMATICAL METHODS
N. Cox, C. Schechter
{"title":"Stata提示152:if和if:何时使用if限定符以及何时使用if命令","authors":"N. Cox, C. Schechter","doi":"10.1177/1536867x231175349","DOIUrl":null,"url":null,"abstract":"Stata has an if qualifier and an if command. Here we discuss generally when you should use either and specifically flag a common pitfall in using the if command. In a nutshell, the pitfall arises from confusing the two constructs: the if command does not loop over the data but, at most, looks in the first observation of a dataset. There has long been a StataCorp FAQ on this topic (Wernow 2005), but we and others have usually tried to explain matters otherwise. This tip is intended as a more durable version of the story that should be easier to find than occasional Statalist postings that are vivid when read but hard to find later.","PeriodicalId":51171,"journal":{"name":"Stata Journal","volume":null,"pages":null},"PeriodicalIF":3.2000,"publicationDate":"2023-06-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Stata tip 152: if and if: When to use the if qualifier and when to use the if command\",\"authors\":\"N. Cox, C. Schechter\",\"doi\":\"10.1177/1536867x231175349\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Stata has an if qualifier and an if command. Here we discuss generally when you should use either and specifically flag a common pitfall in using the if command. In a nutshell, the pitfall arises from confusing the two constructs: the if command does not loop over the data but, at most, looks in the first observation of a dataset. There has long been a StataCorp FAQ on this topic (Wernow 2005), but we and others have usually tried to explain matters otherwise. This tip is intended as a more durable version of the story that should be easier to find than occasional Statalist postings that are vivid when read but hard to find later.\",\"PeriodicalId\":51171,\"journal\":{\"name\":\"Stata Journal\",\"volume\":null,\"pages\":null},\"PeriodicalIF\":3.2000,\"publicationDate\":\"2023-06-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Stata Journal\",\"FirstCategoryId\":\"100\",\"ListUrlMain\":\"https://doi.org/10.1177/1536867x231175349\",\"RegionNum\":2,\"RegionCategory\":\"数学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q1\",\"JCRName\":\"SOCIAL SCIENCES, MATHEMATICAL METHODS\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Stata Journal","FirstCategoryId":"100","ListUrlMain":"https://doi.org/10.1177/1536867x231175349","RegionNum":2,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"SOCIAL SCIENCES, MATHEMATICAL METHODS","Score":null,"Total":0}
引用次数: 0

摘要

Stata有一个if限定符和一个if命令。在这里,我们一般讨论何时应该使用其中之一,并特别指出使用if命令时的一个常见陷阱。简言之,这个陷阱源于混淆了这两个结构:if命令不在数据上循环,最多只在数据集的第一次观察中查看。长期以来,StataCorp一直有关于这个主题的常见问题解答(Wernow 2005),但我们和其他人通常会试图以其他方式解释问题。这条提示是作为一个更持久的故事版本,应该比偶尔发布的Statalist帖子更容易找到,这些帖子读起来很生动,但以后很难找到。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Stata tip 152: if and if: When to use the if qualifier and when to use the if command
Stata has an if qualifier and an if command. Here we discuss generally when you should use either and specifically flag a common pitfall in using the if command. In a nutshell, the pitfall arises from confusing the two constructs: the if command does not loop over the data but, at most, looks in the first observation of a dataset. There has long been a StataCorp FAQ on this topic (Wernow 2005), but we and others have usually tried to explain matters otherwise. This tip is intended as a more durable version of the story that should be easier to find than occasional Statalist postings that are vivid when read but hard to find later.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
Stata Journal
Stata Journal 数学-统计学与概率论
CiteScore
7.80
自引率
4.20%
发文量
44
审稿时长
>12 weeks
期刊介绍: The Stata Journal is a quarterly publication containing articles about statistics, data analysis, teaching methods, and effective use of Stata''s language. The Stata Journal publishes reviewed papers together with shorter notes and comments, regular columns, book reviews, and other material of interest to researchers applying statistics in a variety of disciplines.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信