Ich habe ungefähr 500 Textdateien, die ich kombinieren muss. Alle haben keine Überschriften. Die Werte werden wie folgt durch Komma getrennt. (Das Format ist für alle Dateien gleich.)
122, 3410732003, ABC2, P.
122, 3410732003, ABC2I, 13.6
122, 3410732020, ABC2, P.
122, 3410732020, ABC2I, 4,13
Wenn ich also versuche, die Option zum Importieren mehrerer Dateien in JMP mit CSV-Einstellungen zu verwenden, werde ich gewarnt, dass 500 Datentabellen generiert werden.
Und als ich versuchte, die Dateien mit dem Text zu importieren (eine Zeile pro Zeile), befinden sich alle Daten in einer Spalte.
Leider weiß ich nicht genug über Skripte, um mein eigenes Skript zu schreiben. (Ich habe das angehängte Skript ausprobiert, das ich in diesem Forum gefunden habe, konnte es aber nicht zum Laufen bringen. Ich mache offensichtlich etwas falsch!)
Jede Hilfe dabei wird sehr geschätzt!
So etwas sollte funktionieren:
Names Default To Here(1);
path = "C:\WIP\All text files\"; //note ending \
fileList = Files In Directory(path);
//use first table as "base datatable" to concatenate to
dt = Open(
path || fileList[1],
columns(
New Column("c000001", Numeric, "Continuous", Format("Best", 12)),
New Column("c000002", Numeric, "Continuous", Format("Best", 12)),
New Column("c000003", Numeric, "Continuous", Format("Best", 12)),
New Column("c000004", Character, "Nominal"),
New Column("c000005", Character, "Nominal")
),
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(0),
Column Names Start(1),
Data Starts(1),
Lines To Read("All"),
Year Rule("20xx")
)
);
//start from 2 because we already have file 1 as dt
For(i = 2, i <= N items(fileList), i++,
dt_temp = Open(
path || fileList[i],
columns(
New Column("c000001", Numeric, "Continuous", Format("Best", 12)),
New Column("c000002", Numeric, "Continuous", Format("Best", 12)),
New Column("c000003", Numeric, "Continuous", Format("Best", 12)),
New Column("c000004", Character, "Nominal"),
New Column("c000005", Character, "Nominal")
),
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(0),
Column Names Start(1),
Data Starts(1),
Lines To Read("All"),
Year Rule("20xx")
)
);
dt << Concatenate(dt_temp, Append to first table);
Close(dt_temp, no save);
);