My files are in format .txt , and I'm using JMP 14
This is a part of my script.
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("Source", character, nominal)<<set each value(9999);
dt << Run Formulas();
//add the current table to the bottom of the combined data table
cctable << Concatenate( Data Table( dt ), Append to first table );
//don't use "Create Source Column" argument
Close( dt, NoSave );//after concatenating the table, close it and move on
);//end of the first for loop
Regards,
Anthony