rpg163 发表于 2011-5-3 21:38 
RT,在使用SAS读入CSV数据时,有些数据第一列缺失,后面其实是有数据的,但此时SAS就默认为$1.的格式,结果后面的数据也没有办法读入,不知有什么方法可以解决这个问题。
谢谢
It shouldn`t actually happen unless some specific characters or missing value occur at first row. I think you may need to give out the examples as we could do more for you.
I give you a tricky when importing the CSV file into SAS.
For example, I got a CSV with below components:
invid | subjid | phqtotal | mde |
10 | 1001 | 3 | MDE- |
10 | 1002 | 14 | MDE+ |
10 | 1003 | 4 | MDE- |
10 | 1004 | 12 | MDE+ |
Using Proc Import Wizard first import that CSV file back to SAS, save the defaulted program somewhere. It will be something looks like this:
However, we could also get a better way and more customized way to import the CSV file!
Go to the log tab, You should see something like this in the Log tab:
Well, this is actually how SAS operating inside of the System by this import procedure.
You could copy over the above part SAS code back to use. The most benefit by using this set of code is you could change the format / informat/ length / character or numeric easily! And you can`t realy do that when using "Proc import" code as I show in the first block!
I hope that helps!