繁体   English   中英

SAS PROC SQL验证

[英]SAS PROC SQL VALIDATE

我想知道我是否可以按照以下“ PROC SQL VALIDATE”提出问题:

关于以下PROC SQL查询的哪条语句为“假”?

    proc sql;
validate
select name label="Country",
rate label="Literacy Rate"
from world.literacy 
where "Asia" =
(select continent 
from world.continents
where literacy.name=
continents.country)
order by 2;

我想知道为什么下面的第一个选项不是“ false”?

 (a) The query syntax is not valid. 

 (b) The outer query must pass values to the subquery 
    before the subquery can return values to the outer 
    query

(c) PROC SQL will not execute this query when it is
    submitted   

(d) After the query is submitted, the SAS log will 
    indicate whether the query has valid syntax

答案是(d)我想知道为什么查询语法无效?

非常感谢你!!

您发布的查询具有correlated子查询( from world.continents )。 该子查询无法独立评估,但实际上取决于外部查询传递给它们的值( world.literacy )。

让我解释一下这四个选项,

(a) The query syntax is not valid. - False

不,这是完全有效的语句,其中有一个外部查询和一个子查询。

(b) The outer query must pass values to the subquery before the 
    subquery can return values to the outer query - True

如顶部所述,这是实际发生的情况。

(c) PROC SQL will not execute this query when it is submitted - True

正如您在doumentation中看到的那样validate语句仅在不执行表达式的情况下检查查询表达式的语法和语义的准确性。

(d) After the query is submitted, the SAS log will 
    indicate whether the query has valid syntax - True

同一文档还提到了validate语句在SAS日志中写入一条消息,指出该查询有效。 如果存在错误,则validate将错误消息写入SAS日志。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM