全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件
6035 9
2008-06-24

重复贴!有版友反映,我通过论坛电信通道(https://bbs.pinggu.org/thread-325915-1-1.html)上传的该文档部分教育网用户无法下载,特重新上传!

A Must Read for Stata Programming!

论坛上有此文档的word版本,但格式很乱,而且没有相应链接,使用起来很不方便。现忙里偷闲将其处理成pdf版本,创建了全部链接,并重排版面尽可能使其美观,看起来舒服;同时添加了全部数据和程序文档。

低价有偿分享,希望看过用过觉得好的朋友顶一个,让更多人享有好东西。

引用作者的话“The (Stata programming) manual does a good job of detailing what particular commands do; it does not show how the features work together, and that is what I have tried to focus on...I hope I have communicated the grammar of Stata and not just the vocabulary.”


Table of Contents

Lecture 1..........................................................................................................................1
Review of Stata's programming features............................................................................1
Parsing.....................................................................................................................................4
Parsing options........................................................................................................................8
Parsing complicated syntax.................................................................................................11
Aside on subprograms.........................................................................................................16

Lecture 2........................................................................................................................19
Quotes....................................................................................................................................19
Development continues........................................................................................................23
Temporary variables.............................................................................................................25
Development continues........................................................................................................27
An aside concerning r()........................................................................................................30
Development continues........................................................................................................30
Programming the formulas..................................................................................................31
Putting it together..................................................................................................................35

Lecture 3........................................................................................................................41
What you must learn.............................................................................................................41
Scalars...................................................................................................................................42
Binary accuracy.....................................................................................................................44
Accuracy of macros versus scalars....................................................................................46
Converting a program from macros to scalars.................................................................47
Handling by() options............................................................................................................48
Sorting....................................................................................................................................50
Low-level parsing..................................................................................................................51
Programming immediate commands.................................................................................52
Rewriting mytt in terms of mytti...........................................................................................56
Parsing new variables..........................................................................................................58

Lecture 4........................................................................................................................62
Where are we?......................................................................................................................62
Saved results........................................................................................................................63
What can be returned in r()?...............................................................................................66
Referring to returned results in other programs...............................................................67
Referring to returned results in the program that sets them...........................................68
Other types of returned values: s() and e().......................................................................70
s-class returned values........................................................................................................70
e-class returned results........................................................................................................71
Writing post-estimation commands....................................................................................72
Writing an estimation (e class) command.........................................................................74
An alternative estimation-command outline......................................................................77
Writing estimation commands from first principles..........................................................78
Writing estimation commands via maximum likelihood...................................................82

Lecture 5........................................................................................................................85
Restricting commands to the relevant subsample...........................................................85
Which is better: marksample or mark?..............................................................................88
Programming by varlist:........................................................................................................89
Lists........................................................................................................................................91
Creating lists..........................................................................................................................91
Stepping through list elements one-by-one......................................................................94
Deleting elements from lists................................................................................................95
Adding elements to lists.......................................................................................................96
Macro vectors........................................................................................................................96
Parsing revisited: gettoken..................................................................................................99
Quietly blocks.......................................................................................................................100
The relation between capture and quietly.......................................................................104
Capture blocks.....................................................................................................................104
Naming conventions...........................................................................................................107
Program naming convention.............................................................................................110
Calling convention...............................................................................................................110
Version control.....................................................................................................................112
Conclusion...........................................................................................................................113

Exercises & Answers..................................................................................................114
Exercises & Answers in Lecture 1....................................................................................114
Exercises & Answers in Lecture 2....................................................................................117
Exercises & Answers in Lecture 3....................................................................................129
Exercises & Answers in Lecture 4....................................................................................144
Exercises & Answers in Lecture 5....................................................................................154

222355.rar
大小:(798.1 KB)

只需: 2 个论坛币  马上下载

本附件包括:

  • NetCourseTM 152 - Code & Data.rar
  • NetCourse 152.pdf


[此贴子已经被作者于2008-6-24 19:22:16编辑过]

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2008-7-21 19:56:00
好货也会沉底,自己顶顶!这也是对论坛的贡献。:-)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2008-8-25 15:56:00

看似很强大!被雷到了,不敢下

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2008-8-25 20:50:00
有没有人下了,看了,说说情况啊?谢谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2008-10-25 20:17:00
以下是引用katherina_Fei在2008-8-25 20:50:00的发言:
有没有人下了,看了,说说情况啊?谢谢

已经N人下(N>>20),没人说不好,就是好喽!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2008-10-29 13:52:00
物有所值,高级编程内容,内含数据与代码。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群