楼主: pinggu2688
2787 3

[问答] 求助高手文件名称带有减号如何导入SAS [推广有奖]

  • 2关注
  • 0粉丝

博士生

6%

还不是VIP/贵宾

-

威望
0
论坛币
40 个
通用积分
40.2335
学术水平
1 点
热心指数
3 点
信用等级
1 点
经验
3113 点
帖子
166
精华
0
在线时间
103 小时
注册时间
2009-11-12
最后登录
2024-8-28

楼主
pinggu2688 发表于 2012-1-11 00:29:30 |AI写论文
30论坛币
在用SAS读入文件时文件夹名称和文件名包含减号"-"(注意不是下划线)。导致无法被SAS识别,比如读:
C:\abc - 123-c\abc - 123-c.txt
这个文件,SAS提示错误:ERROR: Physical file does not exist
再不改变名称的情况下如何解决?
多谢

关键词:求助高手 文件名 Physical Error exist ERROR file

沙发
maidenhan 发表于 2012-1-11 09:06:23
I created a file, named "t- e_s#$%^&!~t", and a text file, named "t- e_s#$%^&!~t.txt". My program and results could be found bellow. Maybe it was not the matter of SAS.


9    data test;
10       infile "E:\t- e_s#$%^&!~t\t- e_s#$%^&!~t.txt";
11       input name $;
12   run;

NOTE: Infile "E:\t- e_s#$%^&!~t\t- e_s#$%^&!~t.txt" 是:
      文件名=E:\t- e_s#$%^&!~t\t- e_s#$%^&!~t.txt,
      RECFM=V,LRECL=256

NOTE: 从 Infile "E:\t- e_s#$%^&!~t\t- e_s#$%^&!~t.txt" 中读取了 2 条记录。
       最小记录长度是 5。
       最大记录长度是 5。
NOTE: 数据集 WORK.TEST 有 2 个观测和 1 个变量。
NOTE: “DATA 语句”所用时间(总处理时间):
      实际时间         0.04 秒
      CPU 时间         0.03 秒

藤椅
playmore 发表于 2012-1-11 09:37:46
这个问题应该不是减号引起的
而是空格
用SAS批量改个名字,然后再导入就好了
这种加空格的命名方式本来就不好,改了也无所谓
playmore邀请您访问ChinaTeX论坛!!!进入ChinaTeX论坛

板凳
zhangyangsmith 发表于 2012-1-11 15:25:03
Alternatively, you may check the 8dot3 alias for the file and the directory using dir /x command in a cmd window or X command in SAS. An example in the cmd window follows. In my case it shoud work by using infile "I:\ABC-12~1\ABC-12~1.TXT".


cmd.jpg (64.96 KB)

cmd.jpg

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-4 07:35