Names default to Here(1);
filelist = {"example1_20190214.txt", "example2_20190214.txt"};
filepath = "c:\temp\";
df = nitems(filelist);

for(iii=1, iii<=df, iii++,
filenow  = filelist[iii];

fileopen=(filepath||filenow);
dthdr=open(fileopen,//private,
	Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Tab, 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(0 ),
		Column Names Start(0 ),
		Data Starts( 1 ),
		Lines To Read( 3 ),
		Year Rule( "20xx" )
	)
);
nc = ncol(dthdr);
dthdr << Combine Columns( Delimiter(" "), Columns(2::nc), Column Name("Info") );
dthdr << delete columns(3::nc);

//Transpose header data into new columns and create "Transposed Header Table"
dthdr<< set name( "Header table" );
dtx = dthdr << Transpose(
	columns( :Info ),
	Label( Column(1) ),
	Output Table( "Transposed Header table" )
);
dtx << delete column (:Label);

//Close Header table
Close(dthdr,Nosave); 

//New Column( "Source", Character, Nominal );
//:Source << set each value( filenow );

dt=open(fileopen,//private,
	Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Tab, 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( 4 ),
		Data Starts( 5 ),
		Lines To Read( "All" ),
		Year Rule( "20xx" )
	)
);


New Column( "Source", Character, Nominal );
:Source << set each value( filenow );

//Merge Transposed Header table, dtx,  with raw data table, dt
dtjoined=dt<< Join(
	With( dtx ),
	Cartesian Join
); 

//close Transposed Header table
Close(dtx, NoSave);
//close raw data table, dt
Close(dt, NoSave);

//For the first file, keep it, it will be used to append other file
//For the other files, append then close 
current data table(dtfinal);
If (iii==1 , dtfinal = dtjoined,
	//else
	caption(char(iii)); wait(2); caption(remove);
	dtfinal << Concatenate( dtjoined , Append to first table(1));
	wait(0);
	close(dtjoined, NoSave)
);


//no need for Run Formulas() there are no formulas in the table	

); //end the for iii loop 

//Give the final table a name
dtfinal << set name( "Combined Data Table"); 