Subscribe Bookmark RSS Feed

How to make JSL save empty CSV file?

djhanson

Community Trekker

Joined:

Jun 23, 2011

Is there any way to make JSL save an empty CSV file (meaning only column headers present)?

I would expect JSL to save the CSV file with the 1 row of column headers (and no other rows).  But instead JSL errors out.

I'm using JMP 11.1.1.

Let me know if you know any solutions (other than reconstructing the file with concatenation strings and commas and saving). thanks, DJ

3 REPLIES
djhanson

Community Trekker

Joined:

Jun 23, 2011

What's also crazy about this is that Excel lets you save a blank CSV file and JMP itself allows you to load a blank CSV file.

You would think if JMP doesn't care about loading a blank CSV file why would it now allow saving a blank CSV file?  It's just one row of headers.

pmroz

Super User

Joined:

Jun 23, 2011

You might have to bite the bullet and write out a text file of the column headers.  Not too hard:

dt = New Table( "Example Table", Add Rows( 0 ),

      New Column( "aaaaa", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) ),

      New Column( "bbbbb", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) ),

      New Column( "ccccc", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) ),

      New Column( "ddddd", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) )

);

col_names = dt << get column names(string);

text2save = concat items(col_names, ",");

csvfile = "c:\temp\csv_example.csv";

save text file(csvfile, text2save);

Craige_Hales

Staff

Joined:

Mar 21, 2013

Thanks!  JMP 13 will do it. 

Craige

Craige