gpt4 book ai didi

sas - 打印带分隔符的所有列 SAS

转载 作者:行者123 更新时间:2023-12-04 19:37:49 26 4
gpt4 key购买 nike

我正在尝试打印一个带分隔符的文件,而不必指定所有列。我可以接近,但数字列总是被引用:

DATA _NULL_;
SET SASHELP.CARS (obs = 5 keep = Make Model EngineSize);
FILE "foo.csv" DSD DLM=",";
PUT (_all_) (~);
RUN;

foo.csv

"Acura","MDX","3.5"
"Acura","RSX Type S 2dr","2"
"Acura","TSX 4dr","2.4"
"Acura","TL 4dr","3.2"
"Acura","3.5 RL 4dr","3.5"

我怎样才能实现:

"Acura","MDX",3.5
"Acura","RSX Type S 2dr",2
"Acura","TSX 4dr",2.4
"Acura","TL 4dr",3.2
"Acura","3.5 RL 4dr",3.5

或:

Acura,MDX,3.5
Acura,RSX Type S 2dr,2
Acura,TSX 4dr,2.4
Acura,TL 4dr,3.2
Acura,3.5 RL 4dr,3.5

最佳答案

~ 要求引用。所以,您得到的是报价。

您可以使用 & 代替:

DATA _NULL_;
SET SASHELP.CARS (obs = 5 keep = Make Model EngineSize);
FILE "c:\temp\foo.csv" DSD DLM=",";
PUT (_all_) (&);
RUN;

& 实际上对数据没有影响(我们曾经有过关于它的问题,我不记得最终的答案,但基本上它似乎主要用于这个特定目的,即使那不是它的目的)。

关于sas - 打印带分隔符的所有列 SAS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34052795/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com