医学统计学实习课.ppt_第1页
医学统计学实习课.ppt_第2页
医学统计学实习课.ppt_第3页
医学统计学实习课.ppt_第4页
医学统计学实习课.ppt_第5页
已阅读5页,还剩25页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、A Brief Introduction to Stata(1),1. Getting Started,1.1 Starting STATA 1.2 Running Stata 1.3 Open and Save Datasets in Stata 1.4 Exiting STATA 1.5 Getting help and information 1.6 Notes on STATA Commands 1.7. Entering Data into STATA,1.1 Starting STATA,Start a STATA session by performing either of t

2、he following three procedures: double-click the STATA icon in your desktop. find the STAR button . Use Windows Explorer to navigate across the STATA8 folder and find the button of the executable file named wsestata. Double click on this button.,STATA的用户界面,已执行过的命令窗口,变量窗口,结果输出窗口,STATA windows,Stata Co

3、mmand Stata Results Review Variables,1.2 Running Stata,A command may be typed in the Stata Command window and executed by press the Enter key. Stata running can be interrupted by holding down Ctrl and pressing Pause/Break key.,It is good to open a log_file, press the button or use .log using filenam

4、e. When you want to close the file,use .log close. Append onto the end of the current log. Type .log using myses, append. Discard the old log and replace it with the new one. Type .log using myses, replace. The first choice is probably the best.,You can find out what directory youre in by typing . p

5、wd F:StataStuff If you wanted to make a dirctory on the F drive using Stata, type: . cd F: F:,Do-file,Do-file editor Running do-file Button Do dofile,Data editor,Data Browser Data Editor Rows represent obserbvation. Columns represent variables.,1.3 Open and Save Datasets in Stata,Stata has its own d

6、ata format with default extension .dta .,Open a data file,If the file is in the current directory, .Use filename If the data are not stored in the current directory, .use c:userdata Or .use c:userdata,clear In the first form, use filename says to load the data, but Stata will refuse if (1) there is

7、something in memory and (2) that something has not been saved on disk.,If the memory allocated to STATA (which is 1,000K or 1M by default) is too little for the data file to be opened we will see an error message like the following: . use hh no room to add more observations r(901); The following com

8、mands allocate 30M to STATA and then tries again to open the file: . set memory 30m . use hh If you continue to get an error message, you can try 40m or 50m.,Another important thing to remember is that the memory allocation command (set memory 30m for example) works only if no data set is open. Othe

9、rwise you will get following error message: .use hh .set memory 30m no; data in memory would be lost r(4); You can clear the memory using one of the two commands: clear or drop _all.,Save a data file,To save, type: . save 1998Data . save 1998Data, replace . Save,replace Without the replace option, t

10、he file must not already exist. If it does, Stata will refuse to overwrite it. With the replace option, the file may exist or not. If the file does exist, it will be overwritten.,.cd c:userdata .use bank .save bank,1.4 Exiting STATA,Stata may be exited in three ways: Click into the Close button Sele

11、ct the File menu from the menu bar and select Exit Type. Exit or . exit, clear in the Stata command windows and press return.,if you have an unsaved data set open, STATA will issue the following error message: . exit no; data in memory would be lost r(4); To remedy this problem you can save the data

12、 file and then issue the exit command. If you really want to exit STATA without saving the data file: . exit, clear,1.5 Getting help and information,Statas help system consists of two commands: 1) .help 2) .search You use help when you know the name of the Stata command on which you want information

13、. This command only works if you type the full command name or keyword unabbreviated.,If you can not recall the full command name or keyword, or you are not sure about which command you want you can use the command lookup or search followed by the command name or keyword. . search mem The STATA webs

14、ite (http: /www.stata. com) has excellent help facilities, for example, Online Tutorial, Frequently Asked Questions (FAQ), etc.,1.6 Notes on STATA Commands,STATA commands are typed in lower case. All names, including commands or variable names, can be abbreviated as long as there is no ambiguity. e.

15、g. .describe .des,To display the previous command in Stata Command window, you can press Page-Up key. You can keep doing that until the first command of the session appears. Similarly, the Page-Down key displays the command that follows the currently displayed command in the Stata Command window.,1.

16、7. Entering Data into STATA,the simplest way is to enter data directly into STATAs spreadsheet-like Data Editor window. The nineth button . edit Note that data from spreadsheets can also be copied and pasted into the Editor.,you can entering data variable-by-variable with the TAB key; or observation

17、-by-observation with the ENTER key. a missing value is coded as a period “.” numerical values should not include commas; otherwise STATA considered these values as string.,string variable values can nearly be almost any combination of letters, numbers, and symbols up to 80 characters in length for I

18、ntercooled/ Small and up to 244 characters in length for STATA/SE. /stat/stata/how_to_get_stata.htm variable names can be changed by double clicking anywhere in the variables column resulting in a dialogue box. It is suggested that variable names should have 8 characters.,Reading different types of datafile,Using Stata transfer Other ways read data into STATA from ASCII files and worksheets, We can use the infile command .

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论