BookmarkSubscribe
stanmurphy
New Contributor

Multiple Plots and Files using a for loop based on a Group and BY using JSL

Have a JMP table with say 5 cols
ColA is categrical column. ColA has different group of values. Sample data with just 3 groups from Col A

ColA   ColB    ColC    Y      X
  a         x1       p1       9    PQR1
  a         x1       p2      11   PQR2
  b         x2       p1      12   ABC1
  b         x2       p2      14   ABC1
  b         x2       p3      19   ABC2
  c         x1       p3      16   FGT1
  c         x1       p3       22   FGT3

I am trying to create a JSL script which will give me different html files when
I do a oneway plot for each group in Col A ( in this example 3). However, I want each of the plots to be split by the Col B & Col C. (Thus for the case of our data above, when ColA is a we will have two plots based on Col B & Col C, 3 plots when ColA is b and 1 plot when Col A is c)

 

Eventually by goal is to create journal for each ColA group plots and save them individually to html files.

I have written the following script, but unfortunately not getting what I want. I am getting 3 plots pop up,but no plot is having the required number of plots as expected from the By clause for Col B & Col C.
I am getting 3 html files in which I am getting the same plots in each of them.  ( I may need eval/substitute, which I am not very familiar about)

 

dt = Current Data Table();
summarize(colgroup=by(:ColA));

outfile_path = "xxx\";

for (i=1, i<=N items(colgroup),i++, 
 
     idname = Char(colgroup[i]);
     
     outfile  = outfile_path || "_" || idname || ".html";
     
	 grph_obj = dt << Oneway(
	
	         Y( :Y ),
	         X( :X),
	         Means( 1 ),
	         Box Plots( 1 ),
	         Mean Diamonds( 1 ),
	         By(:ColB, :ColC);
	         Where(:ColA == idname);
			 
	
    ) << show window(0);

       Wait(1); 

       jrn_grph = New Window("Report Group Col A", << Journal) ;
	
	   Wait(1);
	
	   grph_obj  << Journal(Freeze All) << show window(0);
	
	    Wait(5);
	
	    jrn_grph << Set page setup(
	        margins( .5, .5, .5, .5 ),
	        scale( .99 ),
	        portrait( 0 ),
	        paper size( "Letter" ) 
        );
	
	    jrn_grph << Save HTML(outfile); 
		
		Close All (Journals, "No Save");


)

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User ms
Super User

Re: Multiple Plots and Files using a for loop based on a Group and BY using JSL

I have not tested it but I think the code would work as intended with a comma instead of semicolon after By(:ColB, :ColC).

 

 

 

2 REPLIES 2
ms
Super User ms
Super User

Re: Multiple Plots and Files using a for loop based on a Group and BY using JSL

I have not tested it but I think the code would work as intended with a comma instead of semicolon after By(:ColB, :ColC).

 

 

 

stanmurphy
New Contributor

Re: Multiple Plots and Files using a for loop based on a Group and BY using JSL

Wow!!! Perfect!! Yes it works with the comma instead of semicolon.. That's a good thing to know!
0 Kudos