Subscribe Bookmark RSS Feed

It is possible, save a file JMP as .ascii???

josealvarez2685

Community Trekker

Joined:

Mar 6, 2015

It is possible, save a file JMP as .ascii??

6 REPLIES
Craige_Hales

Staff

Joined:

Mar 21, 2013

JMP data tables can be exported as CSV for use with other programs.  Meta data, like column formats and table scripts, is not preserved.

JMP data tables can also create a script (red triangle menu) that will recreate the table with the meta data.

Both of these are plain text formats.  If your table data has non-ASCII strings, the files will contain those strings.

Craige
pmroz

Super User

Joined:

Jun 23, 2011

Not sure if this is what you're asking, but you can save a text string to an ascii file.  For example:

my_ascii_file = "c:\temp\test.ascii";

random_string =

"The quick red fox jumped over the brown log.

The quick red fox jumped over the brown log.

The quick red fox jumped over the brown log.

The quick red fox jumped over the brown log.

The quick red fox jumped over the brown log.";

save text file(my_ascii_file, random_string);

josealvarez2685

Community Trekker

Joined:

Mar 6, 2015

What I have is basically a table in JMP and I want to convert each column in a .ASCII file...???

pmroz

Super User

Joined:

Jun 23, 2011

Try something like this:

dt = open("$sample_data\Big Class.jmp");

for (i = 1, i <= ncols(dt), i++,

    one_col  = column(dt, i);

    one_name = one_col << get name;

    one_type = one_col << get data type;

    col_list = as list(one_col << get values);

    if (one_type == "Numeric",

// For numeric columns convert number to character

        for (k = 1, k < nitems(col_list), k++,

            col_list[k] = char(col_list[k]);

        );

    );

// concatenate all column values together with a line feed between each one

    col_text = concat items(col_list, "

");

    one_file = "c:\temp\" || one_name || ".txt";

    save text file(one_file, col_text);

);

josealvarez2685

Community Trekker

Joined:

Mar 6, 2015

Thank you so much

thank you very much for the help

Now I have a folder with 500 files in txt format and want to import them JMP table, each txt file must correspond to a column in JMP. and each column must be added the name of the txt file.

appreciate your help

Craige_Hales

Staff

Joined:

Mar 21, 2013

or if you want all the columns in one file, export to CSV via JSL like this (or use File->Save):

dt = open("$sample_data\Big Class.jmp");

dt<<save("$temp/test3.csv");

loadtextfile("$temp/test3.csv");

"name,age,sex,height,weight

KATIE,12,F,59,95

LOUISE,12,F,61,123

JANE,12,F,55,74

JACLYN,12,F,66,145

LILLIE,12,F,52,64

...

Craige