簡體   English   中英

SAS:PROC IMPORT CSV - 編碼 - 列名稱中的特定字符

[英]SAS : PROC IMPORT CSV - Encoding - specific caractere in columns names

我們如何在 colnames 中導入具有特定字符的 csv 文件? 當我用 Visual Code 打開這個 CSV 文件時,2 個列名包含這個字符 。 有沒有辦法用 proc import (不是數據步驟)導入我的文件?

SAS 版本 9.04

我試試這個:

filename test2  "my_file.csv" encoding="utf-8" ;


proc import datafile= test2
out=my_df
dbms=dlm
replace;
delimiter=";";
getnames=yes;
GUESSINGROWS=MAX;
run;

引發錯誤:

ERROR: Invalid string.
ERROR: Invalid string.
ERROR: Invalid string.
Nombre de noms trouvé inférieur au nombre de variables trouvé. 
Le nom  n'est pas un nom SAS correct.
Problèmes détectés dans les noms fournis. Consultez le Journal.
....
ERROR: Invalid string.
FATAL: Unrecoverable I/O error detected in the execution of the DATA step program.  Aborted during 
the EXECUTION phase.

做技巧encoding="Windows-1250"

filename test2 "my_file.csv" encoding="Windows-1250" ;


proc import datafile= test2
   out=my_df
   dbms=dlm
   replace;
   delimiter=";";
   getnames=yes;
   GUESSINGROWS=MAX;
run;

提示:選擇正確的編碼:

文件 > 導入數據 > 選擇您的文件... > 在打開的窗口中單擊“Codage ...” > 在我的情況下 Codage “Europe de l'Ouest (Windows)(頁面代碼 1252)正確導入“é”:檢查下面概述。

正確的編碼“1250”語法是指: https : //support.sas.com/documentation/onlinedoc/dfdmstudio/2.6/dmpdmsug/Content/dfU_Encodings.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM