全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3938 14
2014-01-22
悬赏 200 个论坛币 已解决

复制代码
2014-01-22_093601.png

我想把数据集输出到txt文件中,但我想把abc替换成10000个字符长度的值输出到txt文件中,有什么好方法实现吗?谢谢!


最佳答案

yongyitian 查看完整内容

the macro variable temp created by call symput('temp', _infile_); can not be used (by &temp) in the same data step. It can be referenced after the data step have finished. Don't know how to remove the warning. But the file 1234.txt was created correctly with maximum length of 10004. There is not warning this way.
二维码

扫码加我 拉你入群

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

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

全部回复
2014-1-22 09:55:12
dxystata 发表于 2014-1-23 11:54
data aaa;
infile  "F:\123.txt" LRECL=32767;
length x $11000.;
the macro variable temp created by call symput('temp', _infile_);
can not be used (by &temp) in the same data step.

It can be referenced after the data step have finished.

Don't know how to remove the warning. But the file 1234.txt was created correctly with maximum length of 10004.

There is not warning this way.
复制代码

二维码

扫码加我 拉你入群

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

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

2014-1-22 11:13:04
先put到txt文件中,然后再对abc替换!这样在SAS中能实现吗?
二维码

扫码加我 拉你入群

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

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

2014-1-23 09:34:47
复制代码
二维码

扫码加我 拉你入群

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

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

2014-1-23 10:21:35
yongyitian 发表于 2014-1-23 09:34
123.txt
大小:(20 Bytes)

 马上下载

long_string.txt
大小:(9.77 KB)

 马上下载




先把123.txt读入SAS
data aaa;
infile  "F:\123.txt" LRECL=32767;
length x $11000.;
input x:$;
run;


然后把数据集aaa中变量x中含有abc 替换成long_string.txt中内容?



最后得到123.txt(文件名不变)
二维码

扫码加我 拉你入群

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

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

2014-1-23 11:12:35
dxystata 发表于 2014-1-23 10:21
先把123.txt读入SAS
data aaa;
infile  "F:\123.txt" LRECL=32767;
try this
复制代码
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群