ImageVerifierCode 换一换
格式:DOCX , 页数:41 ,大小:33.32KB ,
资源ID:19819256      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/19819256.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(超经典的SAS BASE的笔记3Word格式文档下载.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

超经典的SAS BASE的笔记3Word格式文档下载.docx

1、;data if_01_b; length type $ 8.; set if_01_a; if code=1 then type =Fix if code=2 then type =Variable if code =1 and code =2 then type = Unknown label type =Types of Mortgage Raterun; IF-THEN/ELSE*/data if_01_c; else if code=2 then type = else if code =1 and code =2 then type = Let us see how to divi

2、de age group?data age_grp; input pat_id age ;290156 66 299871 68 280256 64 270456 60 262156 58263256 55 266456 53 250656 44 251256 43 257456 47258356 48 244606 42 249456 41 233256 33 237656 37228356 28 222606 22 219856 21 data age_grp2; length agegrp $ 5.; set age_grp; if 20= age 35 then agegrp = 20

3、-34 else if 35 50 then agegrp = 35-49 else if 50 65 then agegrp = 50-64 else if 65 84 then output ; end;data oss_test2; if school = NT if course =Math if score 86 then output;Earlier you learned to assign values conditionally using IF-THEN/ELSE statements. You can also use SELECT groups in DATA step

4、s to perform conditional processing. A SELECT group contains these statements:This statement.Performs this action.SELECTbegins a SELECT group.WHENidentifies SAS statements that are executed when a particular condition is true.OTHERWISE (optional)specifies a statement to be executed if no WHEN condit

5、ion is met. ENDends a SELECT group. SELECT WHEN-1 (when-expression-1 ) statement;WHEN-n (when-expression-1 OTHERWISE statement;END;Example:data sel; input id salary gender job $;1 2800 0 CA2 3100 0 RN3 2698 1 ME4 4550 1 MD5 3895 1 TAdata sel2; length occupation $ 20 Sex $ 7; set sel; select (id); wh

6、en (1) income=salary*10; when (3,4) income=salary*15; otherwise income=salary*5; select(job); when (CA) occupation=Chartered AccountantRNRegisted NurseMEMechanic IMDDoctor otherwise occupation=Other select(gender); when (0) Sex=Female when (1) Sex=Male otherwise Sex=Basic Concept:2.1.1 Sorting Order

7、s for Numeric VariablesFor numeric variables, the smallest-to-largest comparison sequence is 1.SAS System missing values (shown as a period or special missing value) 2.negative numeric values 3.zero 4.positive numeric values. data sorting_1;. 1 0 -2 3proc sort data =sorting_1; by x;order of output:

8、. -2 0 1 3;2.1.2 Sorting Orders for Character Variablesdata sorting_2; input area $ ;toronto London 535 . hamiltonproc sort data =sorting_2; by area;Output: blank , 535, London, hamilton, toronto2.2 What can SORT do?- Specify the input data set- Create an output data set- Specify the output order- E

9、liminate duplicate observations with common BY values and other options2.3 Applications of PROC SORT procedureThe sort procedure sorts observations in a SAS data set by one or more character or numeric variables, either replacing the original data set or creating a new, sorted data set. PROC SORT by

10、 itself produces no printed output.2.3.1 Observations Sorted by the Values of One VariableIn this example, PROC SORT replaces the original data set, sorted alphabetically by last name, with a data set that is sorted by employee identification number. The statements that produce the output follow:dat

11、a sorting_3;input Name $ IDnumber;datalines;Arnsbarger 5466 Belloit 1988 Capshaw 7338Lemeux 4210 Pierce 5779 Wesley 2092 proc sort ; by idnumber;2.3.2 Observations Sorted by the Values of Multiple VariablesThe businesses in this example are first sorted by town, then by debt from highest amount to l

12、owest amount, then by account number.DESCENDING option: reverses the sort order for the variable that immediately follows in the statement so that observations are sorted from the largest value to the smallest value. data sorting_4; input company $ 1-23 town $ 24-36 debt accnt_num; datalines;Apex Ca

13、tering Apex 37.95 9923 Bobs Beds Morrisville 119.95 4998 Boyd & Sons Accounting Garner 312.49 4762 Deluxe Hardware Garner 467.12 8941 Elway Piano and Organ Garner 65.79 5217 Ice Cream Delight Holly Springs 299.98 2310 Paulines Antiques Morrisville 302.05 9112 Pauls Pizza Apex 83.00 1019Peters Auto P

14、arts Apex 65.79 7288 Strickland Industries Morrisville 657.22 1675 Tinas Pet Shop Apex 37.95 5108 Tims Burger Stand Holly Springs 119.95 6335 Watson Tabor Travel Apex 37.95 3131 World Wide Electronics Garner 119.95 1122 by town descending debt;2.3.3 Create Output Data Set for the Sorted Observations

15、proc sort data = sorting_4 out = sorting_5;2.3.4 Eliminate duplicate observations-NODUPKEY optionIn this example, PROC SORT creates an output data set that contains only the first observation of each BY group. The NODUPKEY option removes an observation from the output data set when its BY value is i

16、dentical to the previous observations BY value. The resulting report contains one observation for each town where the businesses are located. It automatically eliminates multiple observations where the By variables have the same value.options nodate pageno=1 linesize=80 pagesize=60;data account; inp

17、ut Company $ 1-22 Debt 25-30 AccountNumber 33-36 Town $ 39-51;s Pizza 83.00 1019 ApexWorld Wide Electronics 119.95 1122 GarnerStrickland Industries 657.22 1675 MorrisvilleIce Cream Delight 299.98 2310 Holly SpringsWatson Tabor Travel 37.95 3131 Apex Sons Accounting 312.49 4762 Garners Beds 119.95 49

18、98 Morrisvilles Pet Shop 37.95 5108 ApexElway Piano and Organ 65.79 5217 Garners Burger Stand 119.95 6335 Holly Springss Auto Parts 65.79 7288 ApexDeluxe Hardware 467.12 8941 Garners Antiques 302.05 9112 MorrisvilleApex Catering 37.95 9923 Apexproc sort data=account out=towns nodupkey; by town;proc

19、print data=towns; var town company debt accountnumber;title Towns of Customers with Past-Due Accounts- NODUPLICATE /NODUP/NODUPRECS optionIn this example, the NODUPLICATE option removes observations that have duplicate values with BY value.data sorting_6; input pat_id age;290156 66280256 64280156 64

20、262156 58263256 55proc sort data =sorting_6 noduplicate out = sorting_7; by age ;*Nodupkey, nodup, and noduplicate*;data dup; input account_id visit mmddyy10. checking_bal comma9.2 ;201189 11/11/1998 7,865.28201189 11/28/1998 5,724.02201189 12/08/1998 6,908.98202369 11/11/1998 4,405.18204189 11/28/1998 5,724.02204189 12/05/1998 8,054.32225189 11/28/1998 3,632.85225189

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1