view - 无法使用不同于创建视图的库名读取 SAS 视图
问题描述
我在 SAS 中创建了一个视图来读取多个数据集。仅当我提供用于创建视图的相同 libname 时,我才能从该视图中读取数据。
libname test "c:\temp";
data test.one; x=1; run;
data test.two; x=2; run;
data test.three; x=3;
run;proc sql ;
create view test.master as
select * from test.one union
select * from test.two union
select * from test.three;
quit;
data test;
set test.master;
run;
上面的代码运行良好,但是当我打开一个新的 sas 会话并使用不同的 libname 时,如下所示,我收到错误:
libname new "c:\temp";
data test;
set new.master;
run;
ERROR: Libref TEST is not assigned.
ERROR: Libref TEST is not assigned.
ERROR: Libref TEST is not assigned.
ERROR: SQL View TEST.PANEL2 could not be processed because at least one of the data sets, or views, referenced directly (or
indirectly) by it could not be located, or opened successfully.
请指教
解决方案
我不确定我是否认为这是个好主意,但如果您确实想这样做,那么您可以将 libname 定义嵌入到带有using
子句的视图中。将路径也放入视图名称中,您甚至根本不必创建 libref test
。
proc sql ;
create view 'C:\temp\master' as
select * from test.one union
select * from test.two union
select * from test.three
using libname test 'C:\temp'
;
quit;
现在您不需要使用相同的 libref,但请注意您需要使用相同的物理位置。
推荐阅读
- amazon-web-services - CodePipeline 任务修订正在为 ECS Fargate 服务创建,即使我没有更改任何任务定义
- python - 如何在 django 中开发两个导致一个详细视图的列表视图?
- c - 程序以代码退出:5 - 使用 gcc 的 Geany
- javascript - 如何让 Material UI React Textfield 不被文本覆盖,当它具有粘性并且已向上滚动时?
- python - 如何在 ZeroMQ python 中正确声明套接字类型?
- symfony - Symfony 表单:表单类型字段的集合不映射
- javascript - 如何在其父组件之外渲染子组件(DOM Hierarchy) - React.js
- flutter - 在颤振中,CustomPaint() 在脚手架/容器小部件中使用时似乎表现得很奇怪
- c# - 有没有办法从另一个方法中调用文本框字符串中的值?
- xamarin - Xamarin 应用程序在发布模式下启动时崩溃