Subscribe Bookmark RSS Feed

Simple Histogram

noodles

Community Trekker

Joined:

Sep 6, 2012

Hi all,

Here is my code. I was attempting to make a histogram using one of the sample files included with JMP.

dtA = Open("C:\Program Files\SAS\JMP\9\Support Files English\Sample Data\Students1.JMP", Invisible);

histogram = (dtA << Distribution(

                              Nominal Distribution( Column(:age) ),

                              Where ( :sex == "M"),

                              Invisible

                  ));

close (histogram, save("histogram_students.jrp"));

Here is the error I get:

The file cannot be opened for writing, opening for reading only.

invalid argument{233}

in access or evaluation of 'Close' , Close( histogram, save( "histogram_students.jrp" ) )

Any help would be great. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

The close function in this context is for datasets.  You have a graphical object you're trying to save.  This code will work, but it saves to a MS Word file, not a JRP file:

dtA = Open( "$sample_data\Students1.JMP", Invisible );

histogram = (dtA << Distribution(

      Nominal Distribution( Column( :age ) ),

      Where( :sex == "M" ),

      Invisible

      )

);

histogram << save msword("", native) ;

histogram << close window();

close(dta, nosave);

2 REPLIES
Solution

The close function in this context is for datasets.  You have a graphical object you're trying to save.  This code will work, but it saves to a MS Word file, not a JRP file:

dtA = Open( "$sample_data\Students1.JMP", Invisible );

histogram = (dtA << Distribution(

      Nominal Distribution( Column( :age ) ),

      Where( :sex == "M" ),

      Invisible

      )

);

histogram << save msword("", native) ;

histogram << close window();

close(dta, nosave);

noodles

Community Trekker

Joined:

Sep 6, 2012

Thanks PMroz!

I used this line to save it as a png instead:

histogram << save picture("", png);