楼主: qt600
4530 6

[SAS] [求助]请教Base SAS题目(4.01) [推广有奖]

  • 0关注
  • 1粉丝

已卖:2704份资源

本科生

83%

还不是VIP/贵宾

-

威望
0 级
论坛币
5641 个
通用积分
0.9701
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
1143 点
帖子
98
精华
0
在线时间
77 小时
注册时间
2007-2-25
最后登录
2023-9-11

楼主
qt600 发表于 2007-4-1 13:09:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
<P  align=left>A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:<o:p></o:p></P>
<P  align=left>Obsname level<o:p></o:p></P>
<P  align=left>1 Frank 1<o:p></o:p></P>
<P  align=left>2 Joan 2<o:p></o:p></P>
<P  align=left>3 Sui 2<o:p></o:p></P>
<P  align=left>4 Jose 3<o:p></o:p></P>
<P  align=left>5 Burt 4<o:p></o:p></P>
<P  align=left>6 Kelly .<o:p></o:p></P>
<P  align=left>7 Juan 1<o:p></o:p></P>
<P  align=left>The following SAS program is submitted:<o:p></o:p></P>
<P  align=left>data work . expertise;<o:p></o:p></P>
<P  align=left>set work. levels;<o:p></o:p></P>
<P  align=left>if level = . then<o:p></o:p></P>
<P  align=left>expertise = 'Unknown';<o:p></o:p></P>
<P  align=left>else if level = 1 then<o:p></o:p></P>
<P  align=left>expertise = 'Low'; <o:p></o:p></P>
<P  align=left>else if level = 2 or 3 then<o:p></o:p></P>
<P  align=left>expertise =' Medium'; <o:p></o:p></P>
<P  align=left>else<o:p></o:p></P>
<P  align=left>expertise = 'High';<o:p></o:p></P>
<P  align=left>run;<o:p></o:p></P>
<P  align=left>Which of the following values does the variable EXPERTISE contain? <o:p></o:p></P>
<P  align=left><o:p> </o:p></P>
<P  align=left>A. Low, Medium, and High only<o:p></o:p></P>
<P  align=left>B. Low, Medium, and Unknown only<o:p></o:p></P>
<P  align=left>C. Low, Medium, High, and Unknown only<o:p></o:p></P>
<P  align=left>D. Low, Medium, High, Unknown, and ' ' (missing character value)</P>
<P  align=left> </P>
<P  align=left>Answer: B .为什么没有High? </P>
<P  align=left> </P>
二维码

扫码加我 拉你入群

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

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

关键词:Base following Procedure Character Variable 题目 SAS Base

回帖推荐

cxu07 发表于7楼  查看完整内容

When omitting the dot after the 2, sas ignore the trailing sign and the number, in this case , it is @4. So SAS consider the "2" without the dot as column not the 2 digits of the weight. so it reads the second column number, which is 2. so if substituting the 2 with 3, you get missing value, which is dot, sub 2 with 4, you get 9 and so on.

sumc 发表于2楼  查看完整内容

找了半天,终于弄明白了,这个问题还是很能迷惑人的. 在sas中关于or是这样说明的: Remember that only one comparison in a series of OR comparisons must be true to make a condition true, and any nonzero, nonmissing constant is always evaluated as true (see Boolean Numeric Expressions). Therefore, the following subsetting IF statement is always true: if x=1 or 2; SAS first evaluates X=1, and the result c ...

本帖被以下文库推荐

沙发
sumc 发表于 2007-4-2 09:36:00
<P>找了半天,终于弄明白了,这个问题还是很能迷惑人的.</P>
<P>在sas中关于or是这样说明的:</P>
<P>Remember that only one comparison in a series of OR comparisons must be true to make a condition true, and any nonzero, nonmissing constant is always evaluated as true (see <a href="mk:@MSITStore:C:\sassoft\sas\SAS%209.1\nls\zh\help\lrcon.chm::/lrcon.hlp/a000780367.htm#a000695035" target="_blank" >Boolean Numeric Expressions</A>). Therefore, the following subsetting IF statement is always true: </P><PRE>if x=1 or 2;</PRE>
<P>SAS first evaluates X=1, and the result can be either true or false; however, <FONT color=#ee3d11>since the 2 is evaluated as nonzero and nonmissing (true), the entire expression is true.</FONT></P>
<P>因为后面2是一个常数且不为0,所以整个表达式都为真,那么后面都执行同样的操作.</P>
<P>所以如果你的题目想要包含"high",那么应该改为:</P>
<P>~~~</P>
<P align=left>else if level = 2 or level=3 then<O:P></O:P></P>
<P align=left>expertise =' Medium';</P>
<P align=left>~~~~~~~~~~</P>
已有 1 人评分经验 论坛币 收起 理由
bakoll + 2 + 10 精彩帖子

总评分: 经验 + 2  论坛币 + 10   查看全部评分

藤椅
qt600 发表于 2007-4-3 01:32:00
依次类推,凡是用Or来连接的这种形式,else 后面的值一律取不到,是吧?<br>

板凳
qt600 发表于 2007-4-3 01:37:00
<p 2.65pt; text-align: left; line-height: 14pt;" align="left">The following SAS program is submitted:<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">data test;
<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 13.3pt;" align="left">set sasuser.employees;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">if 2 le years_service le 10 then<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">amount=1000;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 13.3pt;" align="left">else if years_service gt 10 then<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">amount=2000;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">else<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">amount=0;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 13.3pt;" align="left">amount_per_year=years_serice/amount;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">run;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 10.65pt;" align="left"><o:p> </o:p></p>


<p 2.65pt; text-align: left; line-height: 16.65pt;" align="left">Which one of the following values does the
variable AMOUNT_PER_YEAR contain<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">if an employee has been with the company for
one year?<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 10.65pt;" align="left"><o:p> </o:p></p>


<p 2.65pt; text-align: left; line-height: 16.65pt;" align="left">A. 0<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">B. 1000<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">C. 2000<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">D. . (missing numeric value)<o:p></o:p></p>

Answer: D.<br>
<br>
这道题是不是因为amount=0, 所以整个值才是missing numeric value? <br>

报纸
zzheng722 发表于 2007-4-3 05:55:00
<P>Yes. You are right. 0 不能作分母, 所以商是missing.</P>

地板
qt600 发表于 2007-4-3 11:46:00
<p 2.65pt; text-align: left; line-height: 16.65pt;" align="left">

</p>
<p 2.65pt; text-align: left; line-height: 14pt;" align="left">The contents of the raw data file SIZE are
listed below:<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 20.65pt;" align="left">----|----10---|----20---|----30<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 13.3pt;" align="left">72 95<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">The following SAS program is submitted:<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">data test;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 13.3pt;" align="left">in file 'size';<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">input@ 1 height 2.@ 4 weight 2;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">run;<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 13.3pt;" align="left">Which one of the following is the value of
the variable WEIGHT in the output data set? <o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 10.65pt;" align="left"><o:p> </o:p></p>


<p 2.65pt; text-align: left; line-height: 17.3pt;" align="left">A. 2<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 13.3pt;" align="left">B. 72<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">C. 95<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 14pt;" align="left">D. . (missing numeric value)<o:p></o:p></p>


<p 2.65pt; text-align: left; line-height: 10.65pt;" align="left"><o:p> </o:p></p>


<p 2.65pt; text-align: left; line-height: 16.65pt;" align="left">Answer:A<br>
I know the problem is to omit the period.SAS assign a length of 2 to weight instead of reading weight with the 2 informat.<br>
I would like to ask why the value of the variable WEIGHT is 2?<br>
<o:p></o:p></p>

<p 2.65pt; text-align: left; line-height: 16.65pt;" align="left"> <o:p></o:p></p>

7楼
cxu07 发表于 2007-4-4 21:34:00
<P>When omitting the dot after the 2, sas ignore the trailing sign and the number, in this case , it is @4.</P>
<P>So SAS consider the "2" without the dot as column not the 2 digits of the weight. so it reads the second column number, which is 2. so if substituting the 2 with 3, you get missing value, which is dot, sub 2 with 4, you get 9 and so on.</P>
已有 1 人评分论坛币 收起 理由
bakoll + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

客服
GMT+8, 2026-12-4 04:14