SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 819|回复: 4
打印 上一主题 下一主题

Can sas read *.txt document ?

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2004-5-3 20:29:07 | 只看该作者

Can sas read *.txt document ?

Can sas read *.txt document ?
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2004-5-4 01:33:47 | 只看该作者
Yes, SAS can do it.  Please take a reference to FILENAME, INFILE and INPUT statements.
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
板凳
 楼主| 发表于 2004-5-6 18:40:42 | 只看该作者
SAS does read .txt files. However, from my experience, when you are using INFILE and INPUT statements to read in the data from a .txt file, you will be having great difficulty if the file contains variable names.

First of all, SAS is not expecting to column names in a text file. So you will have to open .txt in another package (eg. wordpad, word) delete the row with the variable names and save this file.
Second, you will need to specify the directory of where the file is located.

There are several different ways that you can read a dataset into SAS. Normally, I prefer using PROC IMPORT command, because it specifies the variable names and missing data.

Cheers
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
地板
 楼主| 发表于 2004-5-6 21:16:47 | 只看该作者

Thanks so much for your help.

Thanks so much for your help.
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
5#
 楼主| 发表于 2004-5-14 13:22:54 | 只看该作者
if you use "firstobs=2",you don't need edit data.

[quote="Trinity":1566d]SAS does read .txt files. However, from my experience, when you are using INFILE and INPUT statements to read in the data from a .txt file, you will be having great difficulty if the file contains variable names.

First of all, SAS is not expecting to column names in a text file. So you will have to open .txt in another package (eg. wordpad, word) delete the row with the variable names and save this file.
Second, you will need to specify the directory of where the file is located.

There are several different ways that you can read a dataset into SAS. Normally, I prefer using PROC IMPORT command, because it specifies the variable names and missing data.

Cheers[/quote:1566d]
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-1-10 00:01 , Processed in 0.123360 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表