SAS Base 50题中的30和33题疑问
发布:atmosphere7 | 分类:SAS软件培训
关于本站
人大经济论坛-经管之家:分享大学、考研、论文、会计、留学、数据、经济学、金融学、管理学、统计学、博弈论、统计年鉴、行业分析包括等相关资源。
经管之家是国内活跃的在线教育咨询平台!
获取电子版《CDA一级教材》
完整电子版已上线CDA网校,累计已有10万+在读~ 教材严格按考试大纲编写,适合CDA考生备考,也适合业务及数据分析岗位的从业者提升自我。
TOP热门关键词
路过的牛人请分析一下。多谢先。Q30我的疑问---关于autoconversionofcharacter-to-numericvariable:当charactervariable和一个numericvalue比较时,autoconversionwillhappen,为什么这里不行?whenacharactervariabl ...
免费学术公开课,扫码加入![]() |
Q30 我的疑问---关于auto conversion of character-to-numeric variable:
当character variable和一个numeric value比较时,auto conversion will happen,
为什么这里不行?
when a character variable compared to a numeric value, the character
variable will be auto-converted to numberic variable --- from SAS base Prep
Guide P402
以下程序我在sas上试过了,的确是d,但不明白为什么这里不自动转换。
Q30.The descriptor and data portions of the Work.Salaries data set are shown
below.
Variable Type Len Posname Char 8 0
salary status Char 8 Char 8 16 8
name status salary
Liz S 15,600
Herman S 26,700
Marty S 35,000
The following SAS program is submitted: proc print data=work.salaries; where
salary<20000; run; What is displayed in the SAS log after the program is
executed?
a. A NOTE indicating that 1 observation is read.
b. A NOTE indicating that 0 observations were read.
c. A WARNING indicating that character values have been converted to numeric
values.
d. An ERROR indicating that the WHERE clause operator requires compatible
variables.
Correct answer: d
Salary is defined as a character variable. Therefore, the value in the WHERE
statement must be the character value 20,000 enclosed in quotation marks.
************************
Q33 我的疑问---numeric和character variable的default length都是8 characters
(http://www.sfu.ca/sasdoc/sashtml/lrcon/z1103996.htm). 为什么33题中"mlgrams2"结果不被truncate?
Q33.The following SAS program is submitted: data test; input animal1
$ animal2 $ mlgrams1 mlgrams2; cards; hummingbird ostrich 54000.39 90800000
.87 ; run; Which one of the following represents the values of each variable
in the output data set
a. animal1 animal2 mlgrams1 mlgrams2
hummingb ostrich 54000.39 90800000
b. animal1 animal2 mlgrams1 mlgrams2
hummingb ostrich 54000.39 90800000.87
c. animal1 animal2 mlgrams1 mlgrams2
hummingbird ostrich 54000.39 90800000
d. animal1 animal2 mlgrams1 mlgrams2
hummingbird ostrich 54000.39 90800000.87
Correct answer: b
The CARDS statement is an alias for the DATALINES statement. In the INPUT
statement, you must specify a dollar sign ($) after the variable name in
order to define a character variable. If you do not specify otherwise, the
default storage length for a variable is 8. In the example above, the
character value hummingbird is truncated to hummingb.
「经管之家」APP:经管人学习、答疑、交友,就上经管之家!
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
您可能感兴趣的文章
人气文章
本文标题:SAS Base 50题中的30和33题疑问
本文链接网址:https://bbs.pinggu.org/jg/ruanjianpeixun_sasruanjianpeixun_1066388_1.html
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。



