中国高校课件下载中心 》 教学资源 》 大学文库

《医学统计学》课程教学资源(文献资料)Three primary input styles in SAS(三种基本输入方法)

文档信息
资源类别:文库
文档格式:PPT
文档页数:34
文件大小:932KB
团购合买:点击进入团购
内容简介
《医学统计学》课程教学资源(文献资料)Three primary input styles in SAS(三种基本输入方法)
刷新页面文档预览

Three primary input styles in SAS List input Column input Formatted input

Three primary input styles in SAS ——List input ——Column input ——Formatted input

List input you can use the INPUT statement with list input to read 1.free-format data(data that is not organized in fixed fields)自由格式数据 2.free-format data that is separated by nonblank delimiters,such as commas以非 空格为分隔符 3.free-format data that contains missing values含缺失值

List input • you can use the INPUT statement with list input to read 1. free-format data (data that is not organized in fixed fields)自由格式数据 2. free-format data that is separated by nonblank delimiters, such as commas以非 空格为分隔符 3. free-format data that contains missing values含缺失值

4.character values that exceed eight Characters超过8个字符的字符型值 5.nonstandard free-format data非标准 数据 6.character values that contain embedded blanks含嵌入空格的字符型值

4. character values that exceed eight Characters超过8个字符的字符型值 5. nonstandard free-format data非标准 数据 6. character values that contain embedded blanks含嵌入空格的字符型值

Most free-format data fields are clearly separated by blanks and are easy to imagine as variables and observations. But fields can also be separated by other delimiters,such as commas,as shown below. Raw Data File Credit ·例 -+-10-+ -20 MALE,27,1,8,0,0 FEMALE,29,3,14,5,10 FEMALE,34,2,10,3,3 MALE,35,2,12,4,8 FEMALE,36,4,16,37 MALE,21,1,5,0,0 MALE,25,2,9,2,1 FEMALE,21,1,4,26 ALE,38,3,11,4,3 FEMALE,30,3,5,1,0

• Most free-format data fields are clearly separated by blanks and are easy to imagine as variables and observations. But fields can also be separated by other delimiters, such as commas, as shown below. • 例

When characters other than blanks are used to separate the data values,you can tell SAS which field delimiter to use.Use the DLM= option in the INFILE statement to specify a delimiter other than a blank(the default). ·data perm.survey; infile credit dlm=','; input Gender Age Bankcard FreqBank Deptcard FreqDept; run; The field delimiter must not be a character that occurs in a data value

• When characters other than blanks are used to separate the data values, you can tell SAS which field delimiter to use. Use the DLM= option in the INFILE statement to specify a delimiter other than a blank (the default). • data perm.survey; infile credit dlm=','; input Gender $ Age Bankcard FreqBank Deptcard FreqDept; run; • The field delimiter must not be a character that occurs in a data value

例 Reading Missing Values at the End of a Record Suppose the third person represented in the raw data file below did not answer the questions about how many department store credit cards she has and how often she uses them 1-+2-一-10-+- 20 2LE271800 FEMALE 3 14 5 10 FEM2LE34210■ MALE3521248 FEMALE 36 4 16 3 7 MALE211500 MALE252921 FEMALE 21 1 4 2 6 LE3831143 FEMALE 30 3 5 1 0

例 Reading Missing Values at the End of a Record • Suppose the third person represented in the raw data file below did not answer the questions about how many department store credit cards she has and how often she uses them

Because the missing values occur at the end of the record,you can use the MISSOVER option in the INFILE statement to read the missing values at the end of the record. The MISSOVER option prevents SAS from going to another record if,when using list input, it does not find values in the current line for all the INPUT statement variables. At the end of the current record,values that are expected but not found are set to missing

• Because the missing values occur at the end of the record, you can use the MISSOVER option in the INFILE statement to read the missing values at the end of the record. • The MISSOVER option prevents SAS from going to another record if, when using list input, it does not find values in the current line for all the INPUT statement variables. • At the end of the current record, values that are expected but not found are set to missing

·data perm.survey; infile credit missover; input Gender Age Bankcard FreqBank Deptcard FreqDept; run; Obs gender age bankcard fregbank deptcard freqdept male 27 8 0 0 female 29 3 14 5 10 female 只 2 10 male 35 2 female 36 4 16 6 male 21 1 5 0 0

• data perm.survey; infile credit missover; input Gender $ Age Bankcard FreqBank Deptcard FreqDept; run;

Obs gender age bankcard freqbank deptcard freqdept 1 male 27 1 8 0 0 2 female 29 3 14 5 10 3 female 34 2 10 35 4 female 36 4 16 3 7 5 male 21 1 5 0 0

例 Reading Missing Values at the Beginning or Middle of a Record Suppose the value for Age is missing in the first record. Raw Data File Credit2 1-+-10-+-20 ALE,1,8,0,0 FAE,29,3,14,5,10 FEMALE,34,2,10,3,3 ALE,35,2,12,4,8 FEMALE,36,4,16,3,7

例 Reading Missing Values at the Beginning or Middle of a Record • Suppose the value for Age is missing in the first record

刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档