作者peiyu0710 (peiyu)
看板Statistics
標題[程式] 使用SAS打開SAS檔,數據不全
時間Fri Jun 21 22:16:07 2013
[軟體程式類別]:
SAS9.3 (ENGLISH)
[程式問題]:
拿到sas資料檔(sas data set)之後想要直接匯入SAS,結果少了一大半數據
[軟體熟悉度]:
低(1~3個月)-斷斷續續有在學基本語法,但有一陣子沒碰了
[問題敘述]:
1、如果直接點開檔案(.SAS),會出現視窗,其中文字為:
開啓作業失敗,發生下列錯誤。
【Error】Falled to transcode data from utf-16le to wlatin1 encoding
because it contained charaters which are not supported by your
SAS session encoding. Please review your encoding= and locale =
SAS system options to ensure that they can accommodate the data
that you want to process. A portion of the source string, in hex
representation is:
[None] 1b52cc: 47 00 3a 00 5c 00 62 00 6f 00 73 00 74 00 6f 00
[C:\]
2、如果直接用SAS打開檔案,只會出現1-6欄數據,後面都讀不出來
3、查過書(SAS1-2-3、SAS與統計分析)、GOOGLE(關鍵字:SAS utf-16le to
wlatin1),但是找不到解決方法
[程式範例]:
目前google到的程式如下,但是最多只能讀進6欄數據,問題沒有解決...
1、data myfiles.difencoding (encoding=wlatin1);
(出處:support.sas.com/documentation/cdl/en/nlsref/61893/HTML/default/
viewer.htm
#a002601944.htm)
2、
proc datasets lib=SDTM;
modify supplb/correctencoding=wlatin1;
run;
/* Set the correct encoding to ‘WLATIN1’ */
proc datasets lib=stagings;
modify custtype_w1/correctencoding=wlatin1;
run;
/* Transcode data from ‘Wlatin1’ to ‘UTF-8’ */
data stagings.custtype_u8;
set stagings.custtype_w1;
run;
(出處:
http://studysas.blogspot.tw/2012/02/encodingoption-
correctencodingwlatin1.html)
懇請幫忙指點一下可以如何讀到剩下的數據,非常感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.11.138.221
1F:推 tew:原始檔案已毀了 請重新取得 06/22 09:45
2F:→ peiyu0710:謝謝回應,可能是電腦有問題,換另一臺電腦就解決了... 06/22 22:56
3F:推 anovachen:有可能是跟語言編碼有關!!我遇過在中文版讀不到資料, 06/23 03:11
4F:→ anovachen:要在英文版SAS才能讀取資料的情形...= = 06/23 03:11
5F:→ anovachen:呃,講反了。是資料裡有繁體中文字,英文版的讀不到 06/23 03:11