在導入期間更改日期格式大家好!!
我有日期為歐洲格式 (dd-mm-yyyy) 的文件,並且在文件導入期間 jmp 自動轉換為美國格式 (m/d/yy) 。
是否可以更改 jmp 數據格式?
此致,
安東尼
回复:在導入期間更改日期格式JMP 14 可以做到這一點。 首次使用預覽嚮導打開文件並指定您需要的格式。
Specify a d-m-y format for a columnSpecify a d-m-y format for a column為列指定 dmy 格式
打開文件後,右鍵單擊源腳本並對其進行編輯以查看您需要的腳本,如下所示:
Open(
"C:\Users\chales\Desktop\2col.txt",
columns(
New Column( "Col 2", Character, "Nominal" ),
New Column( "Col 3", Numeric, "Continuous", Format( "d/m/y", 10 ), Input Format( "d/m/y" ) )
),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
)
Text data imported with formatText data imported with format帶格式導入的文本數據
回复:在導入期間更改日期格式我的文件格式為 .txt ,我使用的是 JMP 14
這是我腳本的一部分。
names default to here (1);
Clear Symbols();
filelist={}; //empty list
//ouvre une boite de dialogue retournant le chemin du fichier
prefilepath = Pick Directory( "Pick the Top Level Directory" );
If( Host is( Mac ),
filepath="/"||prefilepath,
filepath = Convert File Path( prefilepath, Windows )
);
prefilelist = Files In Directory( filepath, "recursive");
n2=nitems(prefilelist);
//Filtre sur les caractères spécifiées
For( i2 = 1, n2 >= i2, i2++,
file=(prefilelist[i2]);
If( Item( 2, prefilelist[i2], "." ) == "txt" | Item( 2, prefilelist[i2], "." ) == "csv" | Item( 2, prefilelist[i2], "." ) == "dat" & contains(prefilelist[i2],"LVL2") != 0,
Insert Into( filelist,file),
show(file)
)
);
//nombre d'objet dans filelist
nf=nitems(filelist);
For( iii = 1 , iii <= nf, iii++, //this starts the first loop
filenow = ( filelist[iii] );
fileopen=(filepath||filenow);
//dt=open(fileopen,private);
dt=open(fileopen, Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Other( ";" ), CSV( 0 ) ),//use ";" as a delimiter too
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start(56),//starting on second row
Data Starts(57),//data starts on 3rd row
Lines To Read( "All" ),
Year Rule( "20xx" )
), private);//Import settings used in the open argument
New Column( "Source", Character, Nominal );
:Source << set each value( filenow );
//dt<<NEW column=""></NEW>
問候,
安東尼
回复:在導入期間更改日期格式嗨,安東尼,
我認為我們需要更多關於您正在導入的文件格式、您使用的 JMP 版本以及您運行的操作系統的更多信息。通過 support@jmp.com 聯繫 JMP 技術支持,您可能會更幸運。
問候,
布萊恩·科科倫
JMP開發