- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个PROC EXPORT问题,我想知道您是否可以回答。
我有一个SAS数据集,其中包含800多个变量和超过200K的观测值,并且我正在尝试将变量的子集导出到CSV文件(即,我需要所有记录;我只是不想要所有800+个变量)。我总是可以仅在需要的字段上创建一个临时数据集“KEEP”,然后在该临时数据集上运行EXPORT,但是由于我拥有大量记录,因此我试图避免执行附加步骤。
为了说明这一点,请考虑具有三个名为x,y和z的变量的数据集。但是,我希望通过PROC EXPORT生成的文本文件仅包含x和y。我在下面的解决方案中的尝试不太奏效。
SAS代码
当我运行以下代码时,我并没有得到我真正需要的东西。如果运行此代码并查看生成的文本文件,则在每行的末尾都有一个逗号,并且标题仍然包含数据集中的所有变量。另外,我在日志中收到一些我不应该收到的消息。
data ds1;
do x = 1 to 100;
y = x * x;
z = x * x * x;
output;
end;
run;
proc export data=ds1(keep=x y)
file='c:\test.csv'
dbms=csv
replace;
quit;
x,y,z
1,1,
2,4,
3,9,
4,16,
9343 proc export data=ds1(keep=x y)
9344 file='c:\test.csv'
9345 dbms=csv
9346 replace;
9347 quit;
9348 /**********************************************************************
9349 * PRODUCT: SAS
9350 * VERSION: 9.2
9351 * CREATOR: External File Interface
9352 * DATE: 30JUL12
9353 * DESC: Generated SAS Datastep Code
9354 * TEMPLATE SOURCE: (None Specified.)
9355 ***********************************************************************/
9356 data _null_;
9357 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
9358 %let _EFIREC_ = 0; /* clear export record count macro variable */
9359 file 'c:\test.csv' delimiter=',' DSD DROPOVER lrecl=32767;
9360 if _n_ = 1 then /* write column names or labels */
9361 do;
9362 put
9363 "x"
9364 ','
9365 "y"
9366 ','
9367 "z"
9368 ;
9369 end;
9370 set DS1(keep=x y) end=EFIEOD;
9371 format x best12. ;
9372 format y best12. ;
9373 format z best12. ;
9374 do;
9375 EFIOUT + 1;
9376 put x @;
9377 put y @;
9378 put z ;
9379 ;
9380 end;
9381 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
9382 if EFIEOD then call symputx('_EFIREC_',EFIOUT);
9383 run;
NOTE: Variable z is uninitialized.
NOTE: The file 'c:\test.csv' is:
Filename=c:\test.csv,
RECFM=V,LRECL=32767,File Size (bytes)=0,
Last Modified=30Jul2012:12:05:02,
Create Time=30Jul2012:12:05:02
NOTE: 101 records were written to the file 'c:\test.csv'.
The minimum record length was 4.
The maximum record length was 10.
NOTE: There were 100 observations read from the data set WORK.DS1.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
100 records created in c:\test.csv from DS1.
NOTE: "c:\test.csv" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.12 seconds
cpu time 0.06 seconds
最佳答案
根据Itzy对我的问题的评论,这是答案,这正是我所需要的。
proc sql;
create view vw_ds1 as
select x, y from ds1;
quit;
proc export data=vw_ds1
file='c:\test.csv'
dbms=csv
replace;
quit;
关于SAS:PROC EXPORT中的限制变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11727469/
在我的项目代码优化期间,我替换了 var 的所有实例关键词 let因为我认为 var 没有特别的用途.为此,我在所有文件中执行了“查找和替换”操作。 在一些自定义模块中,我使用了如下语句: var e
我遇到过使用“双”导出来创建当前组件的情况。您能否解释一下它是否有真正的用途,或者只是作者的偏好? import React from 'react' import DuckImage from '.
我编写了一个简单的脚本来创建用户 (TestV100)、在该架构中创建表 (Xy100) 并将制表符分隔的平面文件从 hadoop 导出到此 Oracle 表。 这是 shell 脚本:-Export
我真的很困惑: export const foo 导出默认 foo module.exports = foo; 我知道这些是非常基本的,但有人可以区分并向我解释这些。我真的很想明白。 最佳答案 让我们
今天我在我的 AngularJS 项目中采用了 Browserify,但是我还不清楚。在所有示例和博客文章中,我都看到了这样的东西: /app.js: require('./messages'); a
我正在寻找一种方法: 隐藏 HTML 页面结果上的标题 导出时在 highcharts 图表上显示标题(PDF、PNG、JPEG 或打印) 我不知道如何继续。有人可以帮助我吗? 最佳答案 您可以在导出
在我的应用程序的首选项中,我调用以特殊方式处理某些参数的 Activity 。到目前为止它运作良好。但是,为了创建试用版和专业版,我刚刚创建了一个包含所有代码的库和一个调用该库的新演示应用程序。除了由
pentaho cde 导出组件正在为我工作,它导出表数据,文件名为 cda-export.csv,我可以自动设置文件名吗? 最佳答案 尝试使用参数 {filename : 'myfilename
我想从 Gephi 的预览选项卡中导出 SVG/PDF/PNG。导出的网络包括所有节点,但切断了左右两侧的节点标签。如何获得不切断标签的导出 pdf? 最佳答案 您必须通过控制选项 来调整输出的大小。
如标题所述,我在尝试使用我的 perl 模块时遇到此错误,但我不知道它是什么意思,而且我似乎无法在 Internet 上找到任何明确的结果。我的代码由 3 个文件组成:一个脚本 (myApp.pl),
我曾经每天下载一个 firebase 实时数据库的节点,通过导出该节点的 .JSON 文件来监控一些输出。 JSON 文件本身大约 8MB。 最近,我开始收到一个错误: “导出 JSON 无法导出在单
之间有什么区别 export * as bar from 'foo' 和 export { default as bar } from 'foo' 在我的特殊情况下,我尝试了以下两种方法,它们都有效,
我想我要求的是不可能的OOB,但我想确认一下。 我们正在升级到 ES6(使用 Babel)。项目是一个网站,使用 AMD (requirejs)。我想将实用程序模块 (foolib) 转换为 ES6,
我一直在我的 React 中广泛使用命名导出和默认导出,我遇到了这 2 个相似的语法。 从'./Button'导出默认值; export { default } from './Button'; 有人
在此页面 ( http://docs.nodejitsu.com/articles/getting-started/what-is-require ) 上,它指出“如果要将导出对象设置为函数或新对象,
在此页面 ( http://docs.nodejitsu.com/articles/getting-started/what-is-require ) 上,它指出“如果要将导出对象设置为函数或新对象,
我在运行 flow check 时收到此错误,但我不确定这是什么意思。 Cannot use exports as a type because exports is a value. To get
module.export和export有什么区别? 如果module.export对象中有一些属性怎么办?export.xx 会无效吗? 最佳答案 首先是 exports 和 module.expo
我正在学习 typescript 。在研究一些源文件时,我发现声明文件 .d 中有时有 export declare ... 有时只有 export ... .ts. 经过一些测试,在我看来它们是等价
假设我有一个要导出的变量。有什么区别 export const a = 1; 对比 export let a = 1; 我理解const 和let 之间的区别,但是当你导出它们时,有什么区别? 最佳答
我是一名优秀的程序员,十分优秀!