I think your have not presented your question in a good way. If there is no data for the second variable across all records, you do not need to input it. If there is any data for the second variable, without additional information, there is no way to read it in. When I get the second value from a record, I should be able to know it is for variable 2 or variable 3. The basic rule is that people have to know what they want, then find a way to implement it by program. If people are not clear their needs, it will be out of question.作者: shiyiming 时间: 2004-5-6 23:38
I think in this topic [b:dd839]xic[/b:dd839] misunderstood what the host meant (or
alternatively this could be the 2nd time I've incorrectly claimed the posting to be wrong!).
In some cases, we [b:dd839]do[/b:dd839] need to read some missing data files into separate variables. This is what the host intend to do, isn't it?
I just assume your dataset uses a tab as a delimiter and without the variable names at the top of the file. Try the program underneath.
BTW, I have just been using SAS for a week, maybe I am totally wrong!
Cheers作者: shiyiming 时间: 2004-5-7 03:20
The key here is that TAB contains information, Smartie did not mention it. If we ignore the TAB, only considering a data set with space as delimiter, we can see a data set with two records
12 34 23 45
23 31
When you get the second record, there is no way to find out 31 is a value of second variable or the third variable. There must be some logics behind it which was not mentioned in the original posting.作者: shiyiming 时间: 2004-5-7 12:48 标题: Re: 多谢 [quote="smartie":16cd2]我的问题是,例如在abc.txt中文件是如下格式
Hi [b:16cd2]smartie[/b:16cd2], I am now assuming your file uses a space as a delimiter to separate variables and has 4 variables without the variable names at the top of the file(variable2&4 are all using [b:16cd2]one[/b:16cd2] space as delimiters).
To [b:16cd2]xic[/b:16cd2]:
You are definitely correct. I have just studied SAS for a week, so considering the aspects is not as comprehensive as you:).
Could you pls try the program above to read space-delimited files into SAS? I used "proc print" to check the results, the data has been read correctly. If yours does not work properly, tell me the details pls.
Kind regards