导入期间更改日期格式大家好!!
我有欧洲格式的日期文件(dd-mm-yyyy),并且在文件导入期间jmp以美国格式自动转换(m / d / yy)。
是否可以更改jmp数据格式?
最好的祝福,
安东尼
Re:导入时更改日期格式JMP 14可以做到这一点。使用预览向导第一次打开文件并指定所需的格式。
Specify 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 format使用格式导入的文本数据
Re:导入时更改日期格式我的文件格式为.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>
问候,
安东尼
Re:导入时更改日期格式嗨安东尼,
我想我们需要更多关于您要导入的文件格式,您正在使用的JMP版本以及您正在运行的操作系统的更多信息。 您可以通过support@jmp.com与JMP技术支持联系。
问候,
Brian Corcoran
JMP开发
Re:导入时更改日期格式您可以使用三种公式来完成您想要的任务。
一个是= EDATE(A1,48),其中开始日期是A1,你想要的日期是48个月。
第二个是= DATE(年(A1),月(A1)+ 48,DAY(A1)),其中开始日期是A1,你想要48个月的日期。其中每个都将返回10/1/2022。
要获得9/30/2022日期,请使用= DATE(年(A1),月(A1)+2,0)
所有这些日期都是正确的,但您可能想要使用最后一个公式。
有关此主题或任何其他帮助的其他信息数据恢复迪拜。