cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
jcashida
Level I

How to save report as a text file via script?

Hi all,

 

I have a script to run a logistics regression. I then want to save it as a text file, akin to doing a Ctrl+s with that report open, selecting "txt file" in "Save as type", then saving it. Is there a way to script this last saving part? I've tried Save(), SaveAs(), Save Text File() and none of them seem to work. I'm intending to then use a separate bash script to parse through that text file for the exact numbers I need. Thank you.

9 REPLIES 9
txnelson
Super User

Re: How to save report as a text file?

If I am interpreting your question correctly, I believe you are not understanding what is contained in a JMP .rpt file.  It does not contain the results of your logistic analysis.  It only contains the script, and possibly the data table that when run will rerun the logistic analysis.

What I think you want to do, is available directly from the Output Display from the logistic analysis, without having to save it as a file. The following script creates a Logistic Fit and then strips off the Chi Square value and prints it to the log

names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");

lg = Logistic( Y( :sex ), X( :height ), Target Level( "M" ) );

chiSQ = (report(lg)["Whole Model Test"][numbercolbox(3)]<<get)[1];

show( chiSQ );

Output

lg.PNG

The log output

chiSQ = 5.50032691715703;

The Logistic output does not have to be displayed in order to parse the values.

If what you are after, is actually parsing through the script that generates the above you can also request from the output report, to extract the script using      << get script

Jim
jcashida
Level I

Re: How to save report as a text file?

I have a script that looks like this:

jcashida_2-1615957787445.png

 

which if I run, I get a window like this:

 

jcashida_1-1615957756432.png

 

at which point if I press Ctrl+s, pops up a window

 

jcashida_3-1615957891908.png

 

I am able to change the red underlined option to txt. The content of this txt file is basically every output in the report, minus the plots. I'm hoping there's a way to add lines to the script so that it can do the saving-as-txt part for me as well.

 

I'm running JMP 9.0.0

txnelson
Super User

Re: How to save report as a text file?

I do not have JMP 9 installed.  The earliest version I have is JMP 11.  In JMP 11, when you save the JMP report to a .jrp file, you only get something like:

Open("C:\Program Files\SAS\JMPEA\16\Samples\Data\Big Class.jmp");
Logistic(Y(:sex), X(:height));

In JMP 9, do you seem to be indicating that you get a different structure.

It does not appear that there is any direct way to generate the .jrp file in JSL.  The various responses  have all approached the ways you can save the output, but in different formats, that can be read as txt files.

If you can provide the reason you need to have the output in a text file format......that is, what you are going to do with the information you want to read in from the txt file, it would be helpful in guiding the community members in helping you with a response.

Jim
Thierry_S
Super User

Re: How to save report as a text file via script?

Hi,

Here is a script that showcases the use of Save MSWord () command that may meet your requirements

Names Default to Here (1);

dt = New Table( "TEST for REPORT", // PRODUCES DUMMY DATA (not impprotant to the Script)
	Add Rows( 100 ),
	New Column( "X1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[-1.75737689252763, -0.764592545628707, 0.0510173405612358,
			0.296947452630042, 1.07254119757705, -0.457175811296141, 2.2967706289395,
			-2.03142875936277, -0.363048769682677, -0.5070633105302,
			0.154495773405026, 0.369788925828579, 0.597166128844207,
			-1.07960670306945, -1.30872421085908, 0.130645965468011,
			-0.412897094133047, 0.9255870864491, -1.8301802424961, -1.7841388270802,
			1.09327584758963, 0.182884026871625, 0.424531175652736,
			0.0556158029054966, -0.640709634446687, 0.418565044637002,
			0.116564045292701, -2.12143236669799, -0.331469472169104,
			-1.24179988452203, 0.155735483143868, -0.00138870426949338,
			0.466001490590278, 1.36589200985638, -3.22275463841887,
			-0.800508277125038, -1.78007607611038, -1.21967208140065,
			1.30176200548787, -0.480892428153654, 0.158765967966113,
			-0.127576464285864, 0.252459427763925, -1.68598410912989,
			-0.1970956676386, 1.55034428468064, -1.22708700695268,
			-0.0605279865915366, -1.49250653248953, -0.162256456084438,
			-0.0652649037086258, 0.00797946402916947, -1.35256879313255,
			-0.652285809936282, -0.934510673918681, -1.05100651980935,
			-0.791137119509579, -0.204256037124367, 0.870279762249423,
			-0.445336826845759, 0.795010489801338, 0.0995886571396687,
			-0.416148453467265, -2.01017021764025, -1.81678701825346,
			1.69323861834956, 0.143536807692393, -0.0336633898898059,
			-1.09589423234423, 0.80081362059253, 0.934714505656128, 1.2393741198206,
			0.33824576332954, -0.292203308012728, 0.505302707503523,
			-1.00205691512905, 0.0466520972335475, 0.223145974635781,
			-0.624589588016431, 1.28323068510501, 0.50670682478464,
			0.0700531578104748, -2.50121391459843, 1.05477568536072,
			-0.0969894453114527, -3.13034948200876, -0.772134746161867,
			-1.16109167197385, 1.35393467256404, -0.232421055502557,
			-0.28636706790363, 0.434413591597962, 0.742704293993728,
			-0.646790477388557, -1.64641063868416, 1.2771435491761,
			0.639487960805282, 1.747183899193, 0.585001038344993, 0.930693565426168]
		)
	),
	New Column( "X2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[6.0198103129928, 7.20091205222843, 4.65070026886468, 3.17670690687595,
			5.03355092227052, 6.30151380427266, 5.24386848221495, 6.90048447961645,
			9.20918236706509, 4.41506689039341, 7.73943697235743, 4.99394902047945,
			3.65679903427308, 4.83267420173453, 6.74796638714244, 5.38200291743643,
			2.94085457642222, 6.23822904145476, 3.79435790981074, 2.98732948494231,
			7.90936901554754, 3.82084295664395, 4.93889136576797, 4.867614989468,
			6.79411638520983, 4.63770841913521, 5.72297568708847, 5.67278210743382,
			2.87898040841589, 4.77794431031051, 6.69989934770925, 4.18010020602993,
			4.28229869222054, 6.47325820610683, 5.73193412972703, 0.836060701792944,
			4.37959357272853, 4.48982482007942, 4.09977961461508, 4.96013142226247,
			6.45031157468394, 3.18557718923309, 5.28451580294059, 5.44547778148437,
			8.83919395262557, 6.08940873455808, 5.40325273508031, 5.43500364366441,
			3.07766204858337, 4.89637627661071, 6.14412510760593, -0.485587355920933,
			6.20311099333472, 5.09962057513129, 0.983662156370214, 4.56520333800937,
			3.40784971252274, 6.6538883206875, 6.00252057357039, 7.97238557914813,
			2.71015418553192, 3.96580809447913, 7.78900888660749, 4.28555518962493,
			6.01393747682294, 5.94907034495602, 9.84611706857246, 5.79850505627085,
			5.67541478004717, 4.30408910278679, 5.40321729312776, 5.85341408571007,
			4.94639447712469, 4.34708559266172, 4.73871246438279, 3.19787036834528,
			1.00957590923624, 2.47971892470545, 6.20071963231195, 6.97684170194268,
			9.22965462317164, 6.53609378001856, 5.81203830009249, 10.5481367361956,
			6.16969124017285, 4.21970045748313, 5.07606287078316, 2.52494896388046,
			8.31352516884491, 3.71846400818337, 4.02334289547053, 5.86633070726614,
			4.88813438851164, 2.8026412414906, 2.93427614698916, 4.14856696486954,
			3.65940024812031, 7.15564460250633, 4.31207256865605, 5.1138900371015]
		)
	),
	New Column( "Y",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( :X1 + :X2 + Random Normal( 0, 0.5 ) ),
		Set Selected
	)
);
fm = dt << Fit Model(			// SIMPLE ANALYSIS TO GENERATE A REPORT
			Y( :Y ),
			Effects( :X1, :X2, :X1 * :X2 ),
			Personality( "Standard Least Squares" ),
			Emphasis( "Effect Leverage" ),
			Run(
				:Y << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
				Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
				Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
				Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
				Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
				Box Cox Y Transformation( 0 )}
			)
		);


// THAT'S THE PART THAT YOU ARE LOOKING FOR

fmr = fm << report;

fmr << Save MSWord (""); // Use this if you need to enter the path and name manually

//or

fmr << Save MSWord ("path and name of file") // Use this if you know the path and name of the file 
											//	(replace the string with your desired location)

Let us know if that works for you.

 

Best,

TS

Thierry R. Sornasse
jcashida
Level I

Re: How to save report as a text file via script?

This is very close to what I am looking for. However, it seems "Save MSWord' tries to save the entire content of the report, and thus not suitable to save as a txt format. Trying to open the txt file saved via this method in a text editor causes errors because of binary data.
txnelson
Super User

Re: How to save report as a text file via script?

Can you be more specific on what you are attempting to extract from your parsing of the saved text file?   And, why does it have to be in a text file form? 

If you are not interested in extracting the data directly from the Output Display Tree you can save it in an outline format

names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");

lg = Logistic( Y( :sex ), X( :height ), Target Level( "M" ) );

chiSQ = (report(lg)["Whole Model Test"][numbercolbox(3)]<<get)[1];

show( chiSQ );

report(lg)<<journal;
txtVal = char( current journal()<<get script);

Save Text File("your path", txtVal );

The output looks like this:

"New Window(\!"Untitled\!", <<Journal, Journal Box(\!"ListBox(vertical,near,sub(
OwnerBox(sub(
OutlineBox(
open(1),title(\!\!\!"Response Y\!\!\!"),rerun(Fit Model(Y(:Y), Effects(:X1, :X2, :X1 * :X2), Personality(\!\!\!"Standard Least Squares\!\!\!"), Emphasis(\!\!\!"Effect Leverage\!\!\!"), Run(:Y << {Summary of Fit(1), Analysis of Variance(1), Parameter Estimates(1), Lack of Fit(0), Scaled Estimates(0), Plot Actual by Predicted(1), Plot Regression(0), Plot Residual by Predicted(1), Plot Studentized Residuals(0), Plot Effect Leverage(1), Plot Residual by Normal Quantiles(0), Box Cox Y Transformation(0)}))),Context({Y(\!\!\!"Y\!\!\!")}),default font id(2),helpKey(\!\!\!"FitLS\!\!\!"),sub(
WrapListBox(sub(
OutlineBox(
open(1),title(\!\!\!"Whole Model\!\!\!"),default font id(2),helpKey(\!\!\!"FitLS Whole\!\!\!"),sub(
OutlineBox(
open(1),title(\!\!\!"Actual by Predicted Plot\!\!\!"),default font id(2),helpKey(\!\!\!"Fit YByPred\!\!\!"),sub(
PictureBox(sub(
BorderBox(top(8),left(5),bottom(8),right(14),sides(16384),options(0),xmin(0),ymin(0),sub(
ScaleBox(id(1),axis(scaleType(0),scaleOrig(-2),scaleWidth(14),widthMajor(2),
nbin(7),nminor(0),timeCode(0),ndec(0),ndecSpec(99),FieldWidth(9),
MinInitInt(-2),MaxInitInt(12),LinearInit,MajorInit(2),MinorInit(0),NObsInit(100),
options(prohibitLogScale,showMajorTicks,showMinorTicks,showLabels,noMinorTickLabelsOnLogAxis,),scaleTypeOptions(),nLabelRows(1),labelRows(LabelRowNumeric(default font id(7),),),labelRows12(LabelRowContinuous(options(0),Automatic Font Size(0),Automatic Tick Marks(0),Inside Ticks(0),Label Alignment(\!\!\!"Near\!\!\!"),Label Buffer Scale(1),Label Orientation(\!\!\!"Horizontal\!\!\!"),Lax Label Range(0),Line Color(2147483647),Line Width(1),Major Grid Line Color(-14145495),Minimum Depth(0),Minimum Font Size(7),Minor Grid Line Color(-15790320),Show Major Grid(0),Show Major Labels(1),Show Major Ticks(1),Show Minor Grid(0),Show Minor Labels(0),Show Minor Ticks(1),Tick Offset(0),Truncate format to interval(1),Wrap Lines(0),default font id(7),),),),length(266),baselength(266),sub(
ScaleBox(id(2),axis(scaleType(0),scaleOrig(-2),scaleWidth(14),widthMajor(2),
nbin(7),nminor(0),timeCode(0),ndec(0),ndecSpec(99),FieldWidth(9),
MinInitInt(-2),MaxInitInt(12),LinearInit,MajorInit(2),MinorInit(0),NObsInit(100),
options(showMajorTicks,showMinorTicks,showLabels,noMinorTickLabelsOnLogAxis,),scaleTypeOptions(),nLabelRows(1),labelRows(LabelRowNumeric(default font id(7),),),labelRows12(LabelRowContinuous(options(0),Automatic Font Size(0),Automatic Tick Marks(0),Inside Ticks(0),Label Alignment(\!\!\!"Near\!\!\!"),Label Buffer Scale(1),Label Orientation(\!\!\!"Horizontal\!\!\!"),Lax Label Range(0),Line Color(2147483647),Line Width(1),Major Grid Line Color(-14145495),Minimum Depth(0),Minimum Font Size(7),Minor Grid Line Color(-15790320),Show Major Grid(0),Show Major Labels(1),Show Major Ticks(1),Show Minor Grid(0),Show Minor Labels(0),Show Minor Ticks(1),Tick Offset(0),Truncate format to interval(1),Wrap Lines(0),default font id(7),),),),length(200),baselength(200),sub(
ListBox(horizontal,near,sub(
AxisBox(side(R),size(44,200),locked(false),scales(0,2,0,2),sub(
TextEditBox(\!\!\!"Y Actual\!\!\!",default font id(9),wrapWidth(200),justification(1),vjustification(1),left,minSize(16,43),maxSize(16,43),BaseSize(0,0),sizeID(0,-1),))),
ListBox(vertical,near,sub(
FrameBox(size(266,200),border(12303),flags(0),markerSize(-1),ndisallow(1),disallow(\!\!\!"Background Map\!\!\!"),scales(1,2,1,2),seg(
,LineSeg(description(\!\!\!"Line of Mean\!\!\!"),properties(color(5), width(2), transparency(0.75)),n(2),x(-9,22.5),y(4.910450521166,4.910450521166),log curve(false),selectable(false),selectionMode(0),),IfSeg(description(\!\!\!"0.05 Significance Curve\!\!\!"),sub(
PolySeg(n(174),
x(-9,-8.5078125,-8.015625,-7.5234375,-7.03125,-6.5390625,-6.046875,-5.5546875,-5.0625,-4.5703125,
-4.078125,-3.5859375,-3.09375,-2.6015625,-2.109375,-1.6171875,-1.125,-0.6328125,-0.140625,0.10546875,
0.3515625,0.59765625,0.84375,1.08984375,1.3359375,1.58203125,1.828125,2.07421875,2.3203125,2.56640625,
2.8125,3.05859375,3.3046875,3.55078125,3.796875,4.04296875,4.2890625,4.53515625,4.78125,5.02734375,
5.2734375,5.51953125,5.765625,6.01171875,6.2578125,6.50390625,6.75,6.99609375,7.2421875,7.48828125,
7.734375,7.98046875,8.2265625,8.47265625,8.71875,8.96484375,9.2109375,9.45703125,9.703125,9.94921875,
10.1953125,10.44140625,10.6875,11.1796875,11.671875,12.1640625,12.65625,13.1484375,13.640625,14.1328125,
14.625,15.1171875,15.609375,16.1015625,16.59375,17.0859375,17.578125,18.0703125,18.5625,19.0546875,
19.546875,20.0390625,20.53125,21.0234375,21.515625,22.0078125,22.5,22.5,22.0078125,21.515625,
21.0234375,20.53125,20.0390625,19.546875,19.0546875,18.5625,18.0703125,17.578125,17.0859375,16.59375,
16.1015625,15.609375,15.1171875,14.625,14.1328125,13.640625,13.1484375,12.65625,12.1640625,11.671875,
11.1796875,10.6875,10.44140625,10.1953125,9.94921875,9.703125,9.45703125,9.2109375,8.96484375…

Also, the output can be saved in an XML data structure

xmlVal = char(report(lg)<<get xml);
Save Text File("your path", xmlVal );

It's output looks like

<OutlineBox width=\!"418\!" height=\!"697\!" helpKey=\!"Logistic Report\!" isOpen=\!"true\!">Logistic Fit of sex By height<IfBox leftOffset=\!"12\!" topOffset=\!"25\!" width=\!"405\!" height=\!"319\!" isTrue=\!"true\!">
    <PictureBox width=\!"405\!" height=\!"319\!">
      <BorderBox width=\!"405\!" height=\!"319\!">
        <ScaleBox leftOffset=\!"5\!" topOffset=\!"5\!" width=\!"395\!" height=\!"309\!" charID=\!"1\!" ID=\!"1\!">
          <ScaleBox width=\!"395\!" height=\!"309\!" charID=\!"2\!" ID=\!"2\!">
            <ScaleBox width=\!"395\!" height=\!"309\!" charID=\!"3\!" ID=\!"3\!">
              <ListBox width=\!"395\!" height=\!"309\!">
                <AxisBox width=\!"56\!" height=\!"269\!" charID=\!"2\!">
                  <DropBox leftOffset=\!"0\!" topOffset=\!"126\!" width=\!"18\!" height=\!"16\!">
                    <TextEditBox width=\!"18\!" height=\!"16\!">sex</TextEditBox>
                  </DropBox>
                </AxisBox>
                <ListBox leftOffset=\!"56\!" topOffset=\!"0\!" width=\!"321\!" height=\!"309\!">
                  <FrameBox width=\!"321\!" height=\!"269\!" helpKey=\!"FitNom Plot\!">
                    <SegPlaceholder description=\!"Grid Lines\!"/>
                    <SegPlaceholder description=\!"Reference Lines\!"/>
                    <IfSeg description=\!"Probability Curves\!" isTrue=\!"true\!">
                      <LineSeg/>
                    </IfSeg>
                    <IfSeg isTrue=\!"true\!">
                      <MarkerSeg/>
                    </IfSeg>
                    <IfSeg isTrue=\!"false\!">
                      <LineSeg description=\!"Rate Curve\!"/>
                    </IfSeg>
                  </FrameBox>
                  <AxisBox leftOffset=\!"0\!" topOffset=\!"269\!" width=\!"321\!" height=\!"40\!" charID=\!"1\!">
                    <DropBox leftOffset=\!"143\!" topOffset=\!"24\!" width=\!"35\!" height=\!"16\!">
                      <TextEditBox width=\!"35\!" height=\!"16\!">height</TextEditBox>
                    </DropBox>
                  </AxisBox>
                </ListBox>
                <AxisBox leftOffset=\!"377\!" topOffset=\!"0\!" width=\!"18\!" height=\!"269\!" charID=\!"3\!"/>
              </ListBox>
            </ScaleBox>
          </ScaleBox>
        </ScaleBox>
      </BorderBox>
    </PictureBox>
  </IfBox>
  <OutlineBox leftOffset=\!"12\!" topOffset=\!"344\!" width=\!"94\!" height=\!"25\!" helpKey=\!"Logistic Iterations Report\!" isOpen=\!"false\!">Iterations<TableBox leftOffset=\!"12\!" topOffset=\!"25\!">
      <NumberColBox>
        <NumberColBoxHeader>Iter</NumberColBoxHeader>
        <NumberColBoxItem>0</NumberColBoxItem>
        <NumberColBoxItem>1</NumberColBoxItem>
        <NumberColBoxItem>2</NumberColBoxItem>
        <NumberColBoxItem>3</NumberColBoxItem>
        <NumberColBoxItem>4</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox>
        <NumberColBoxHeader>Objective</NumberColBoxHeader>
        <NumberColBoxItem>27.725887222</NumberColBoxItem>
        <NumberColBoxItem>24.82346039</NumberColBoxItem>
        <NumberColBoxItem>24.775518767</NumberColBoxItem>
        <NumberColBoxItem>24.775389091</NumberColBoxItem>
        <NumberColBoxItem>24.77538909</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox>
        <NumberColBoxHeader>Relative Gradient</NumberColBoxHeader>
        <NumberColBoxItem>2.3440989376</NumberColBoxItem>
        <NumberColBoxItem>0.3046124766</NumberColBoxItem>
        <NumberColBoxItem>0.0160880971</NumberColBoxItem>
        <NumberColBoxItem>0.0000491383</NumberColBoxItem>
        <NumberColBoxItem>4.622843e-10</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox>
        <NumberColBoxHeader>Norm Gradient</NumberColBoxHeader>
        <NumberColBoxItem>155.01290269</NumberColBoxItem>
        <NumberColBoxItem>6.4687304657</NumberColBoxItem>
        <NumberColBoxItem>0.0335930795</NumberColBoxItem>
        <NumberColBoxItem>0.0003601736</NumberColBoxItem>
        <NumberColBoxItem>5.6284711e-9</NumberColBoxItem>
      </NumberColBox>
    </TableBox>
  </OutlineBox>
  <OutlineBox leftOffset=\!"12\!" topOffset=\!"369\!" width=\!"374\!" height=\!"182\!" helpKey=\!"FitNom Whole\!" isOpen=\!"true\!">Whole Model Test<TableBox leftOffset=\!"12\!" topOffset=\!"25\!" width=\!"361\!" height=\!"70\!">
      <StringColBox width=\!"61\!" height=\!"68\!">
        <StringColBoxHeader>Model</StringColBoxHeader>
        <StringColBoxItem>Difference</StringColBoxItem>
        <StringColBoxItem>Full</StringColBoxItem>
        <StringColBoxItem>Reduced</StringColBoxItem>
      </StringColBox>
      <NumberColBox leftOffset=\!"61\!" topOffset=\!"0\!" width=\!"95\!" height=\!"68\!">
        <NumberColBoxHeader>-LogLikelihood</NumberColBoxHeader>
        <NumberColBoxItem>2.750163</NumberColBoxItem>
        <NumberColBoxItem>24.775389</NumberColBoxItem>
        <NumberColBoxItem>27.525553</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox leftOffset=\!"156\!" topOffset=\!"0\!" width=\!"58\!" height=\!"34\!">
        <NumberColBoxHeader>DF</NumberColBoxHeader>
        <NumberColBoxItem>1</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox leftOffset=\!"214\!" topOffset=\!"0\!" width=\!"68\!" height=\!"34\!">
        <NumberColBoxHeader>ChiSquare</NumberColBoxHeader>
        <NumberColBoxItem>5.500327</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox leftOffset=\!"282\!" topOffset=\!"0\!" width=\!"78\!" height=\!"34\!">
        <NumberColBoxHeader>Prob&gt;ChiSq</NumberColBoxHeader>
        <NumberColBoxItem>0.0190*</NumberColBoxItem>
      </NumberColBox>
    </TableBox>
    <TextBox leftOffset=\!"12\!" topOffset=\!"95\!" width=\!"6\!" height=\!"16\!"></TextBox>
    <TableBox leftOffset=\!"12\!" topOffset=\!"111\!" width=\!"208\!" height=\!"70\!">
      <StringColBox width=\!"155\!" height=\!"68\!">
        <StringColBoxHeader></StringColBoxHeader>
        <StringColBoxItem>RSquare (U)</StringColBoxItem>
        <StringColBoxItem>AICc</StringColBoxItem>
        <StringColBoxItem>BIC</StringColBoxItem>
        <StringColBoxItem>Observations (or Sum Wgts)</StringColBoxItem>
      </StringColBox>
      <ColStackBox leftOffset=\!"155\!" topOffset=\!"0\!" width=\!"52\!" height=\!"68\!">
        <ColStackBoxHeader></ColStackBoxHeader>
        <NumberColBox width=\!"52\!" height=\!"17\!">
          <NumberColBoxHeader></NumberColBoxHeader>
          <NumberColBoxItem>0.0999</NumberColBoxItem>
        </NumberColBox>
        <NumberColBox leftOffset=\!"0\!" topOffset=\!"17\!" width=\!"52\!" height=\!"17\!">
          <NumberColBoxHeader></NumberColBoxHeader>
          <NumberColBoxItem>53.8751</NumberColBoxItem>
        </NumberColBox>
        <NumberColBox leftOffset=\!"0\!" topOffset=\!"34\!" width=\!"52\!" height=\!"17\!">
          <NumberColBoxHeader></NumberColBoxHeader>
          <NumberColBoxItem>56.9285</NumberColBoxItem>
        </NumberColBox>
        <NumberColBox leftOffset=\!"0\!" topOffset=\!"51\!" width=\!"52\!" height=\!"17\!">
          <NumberColBoxHeader></NumberColBoxHeader>
          <NumberColBoxItem>40</NumberColBoxItem>
        </NumberColBox>
      </ColStackBox>
    </TableBox>
  </OutlineBox>
  <OutlineBox leftOffset=\!"12\!" topOffset=\!"551\!" width=\!"96\!" height=\!"25\!" isOpen=\!"false\!">Fit Details<TableBox leftOffset=\!"12\!" topOffset=\!"25\!">
      <StringColBox>
        <StringColBoxHeader>Measure</StringColBoxHeader>
        <StringColBoxItem>Entropy RSquare</StringColBoxItem>
        <StringColBoxItem>Generalized RSquare</StringColBoxItem>
        <StringColBoxItem>Mean -Log p</StringColBoxItem>
        <StringColBoxItem>RASE</StringColBoxItem>
        <StringColBoxItem>Mean Abs Dev</StringColBoxItem>
        <StringColBoxItem>Misclassification Rate</StringColBoxItem>
        <StringColBoxItem>N</StringColBoxItem>
      </StringColBox>
      <ColStackBox>
        <ColStackBoxHeader></ColStackBoxHeader>
        <NumberColBox>
          <NumberColBoxHeader>Training</NumberColBoxHeader>
          <NumberColBoxItem>0.0999</NumberColBoxItem>
          <NumberColBoxItem>0.1719</NumberColBoxItem>
          <NumberColBoxItem>0.6194</NumberColBoxItem>
          <NumberColBoxItem>0.4617</NumberColBoxItem>
          <NumberColBoxItem>0.4286</NumberColBoxItem>
          <NumberColBoxItem>0.3500</NumberColBoxItem>
        </NumberColBox>
        <NumberColBox>
          <NumberColBoxHeader></NumberColBoxHeader>
          <NumberColBoxItem>40</NumberColBoxItem>
        </NumberColBox>
      </ColStackBox>
      <StringColBox>
        <StringColBoxHeader>Definition</StringColBoxHeader>
        <StringColBoxItem>1-Loglike(model)/Loglike(0)</StringColBoxItem>
        <StringColBoxItem>(1-(L(0)/L(model))^(2/n))/(1-L(0)^(2/n))</StringColBoxItem>
        <StringColBoxItem>∑ -Log(ρ[j])/n</StringColBoxItem>
        <StringColBoxItem>√ ∑(y[j]-ρ[j])²/n</StringColBoxItem>
        <StringColBoxItem>∑ |y[j]-ρ[j]|/n</StringColBoxItem>
        <StringColBoxItem>∑ (ρ[j]≠ρMax)/n</StringColBoxItem>
        <StringColBoxItem>n</StringColBoxItem>
      </StringColBox>
    </TableBox>
  </OutlineBox>
  <OutlineBox leftOffset=\!"12\!" topOffset=\!"576\!" width=\!"350\!" height=\!"120\!" helpKey=\!"FitNom ParmEst\!" isOpen=\!"true\!">Parameter Estimates<TableBox leftOffset=\!"12\!" topOffset=\!"25\!" width=\!"337\!" height=\!"53\!">
      <StringColBox width=\!"54\!" height=\!"51\!">
        <StringColBoxHeader>Term</StringColBoxHeader>
        <StringColBoxItem>Intercept</StringColBoxItem>
        <StringColBoxItem>height</StringColBoxItem>
      </StringColBox>
      <StringColBox leftOffset=\!"54\!" topOffset=\!"0\!" width=\!"0\!" height=\!"51\!">
        <StringColBoxHeader>~Bias</StringColBoxHeader>
        <StringColBoxItem></StringColBoxItem>
        <StringColBoxItem></StringColBoxItem>
      </StringColBox>
      <NumberColBox leftOffset=\!"54\!" topOffset=\!"0\!" width=\!"71\!" height=\!"51\!">
        <NumberColBoxHeader>Estimate</NumberColBoxHeader>
        <NumberColBoxItem>-12.267957</NumberColBoxItem>
        <NumberColBoxItem>0.19939641</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox leftOffset=\!"125\!" topOffset=\!"0\!" width=\!"65\!" height=\!"51\!">
        <NumberColBoxHeader>Std Error</NumberColBoxHeader>
        <NumberColBoxItem>5.9870108</NumberColBoxItem>
        <NumberColBoxItem>0.0954697</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox leftOffset=\!"190\!" topOffset=\!"0\!" width=\!"68\!" height=\!"51\!">
        <NumberColBoxHeader>ChiSquare</NumberColBoxHeader>
        <NumberColBoxItem>4.20</NumberColBoxItem>
        <NumberColBoxItem>4.36</NumberColBoxItem>
      </NumberColBox>
      <NumberColBox leftOffset=\!"258\!" topOffset=\!"0\!" width=\!"78\!" height=\!"51\!">
        <NumberColBoxHeader>Prob&gt;ChiSq</NumberColBoxHeader>
        <NumberColBoxItem>0.0405*</NumberColBoxItem>
        <NumberColBoxItem>0.0367*</NumberColBoxItem>
      </NumberColBox>
    </TableBox>
    <IfBox leftOffset=\!"12\!" topOffset=\!"78\!" isTrue=\!"false\!" isVisible=\!"false\!">
      <TextBox></TextBox>
    </IfBox>
    <TextBox leftOffset=\!"12\!" topOffset=\!"78\!" width=\!"107\!" height=\!"16\!">For log odds of M/F</TextBox>
    <OutlineBox leftOffset=\!"12\!" topOffset=\!"94\!" width=\!"191\!" height=\!"25\!" helpKey=\!"Logistic Covariance\!" isOpen=\!"false\!">Covariance of Estimates<MatrixBox leftOffset=\!"12\!" topOffset=\!"25\!">Cov
        <MatrixBoxRowName>Intercept</MatrixBoxRowName>
        <MatrixBoxRowName>height</MatrixBoxRowName>
        <MatrixBoxColName>Intercept</MatrixBoxColName>
        <MatrixBoxColName>height</MatrixBoxColName>
        <MatrixBoxCell>35.844</MatrixBoxCell>
        <MatrixBoxCell>-0.571</MatrixBoxCell>
        <MatrixBoxCell>-0.571</MatrixBoxCell>
        <MatrixBoxCell>0.0091</MatrixBoxCell>
      </MatrixBox>
    </OutlineBox>
  </OutlineBox>
</OutlineBox>
Jim
txnelson
Super User

Re: How to save report as a text file via script?

I forgot an additional text output.  You can output HTML form of the display, and since HTML is a text file, you can parse it

<!doctype html public "-//W3C//DTD HTML 4.0//EN">
<html><head><title>
JMP Report
</title><style>
body { font-family: Arial, sans-serif; font-size: 12px; padding: 0; margin: 10px; }
table { border-color: #a9a9a9; border-collapse: collapse; }
td,th { border-color: #a9a9a9; }
img { border: 1px solid #a9a9a9; }
h1,h2,h3,h4,h5 { padding: 0; margin: 5px 0px; }
</style>
</head><body>

<h2>Logistic Fit of sex By height</h2>
<img src="gfx/image36987882241.png" width=410 height=324><br>
<br>
<br>
<br>

<h3>Whole Model Test</h3>

<table border=1 cellpadding=2 cellspacing=1>
<tr style="vertical-align:top" align=right><th bgcolor=#D9D9D9 align=left>Model</th><th bgcolor=#D9D9D9> -LogLikelihood</th><th bgcolor=#D9D9D9>DF</th><th bgcolor=#D9D9D9>ChiSquare</th><th bgcolor=#D9D9D9>Prob&gt;ChiSq</th></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">Difference</td><td>2.750163</td><td>1</td><td>5.500327</td><td><font COLOR="#f03246">0.0190*</td></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">Full</td><td>24.775389</td><td></td><td></td><td></td></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">Reduced</td><td>27.525553</td><td></td><td></td><td></td></tr>
</table><br>
<br>

<table border=1 cellpadding=2 cellspacing=1>
<tr style="vertical-align:top" align=right><td style="text-align:left">RSquare (U)</td><td>0.0999</td></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">AICc</td><td>53.8751</td></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">BIC</td><td>56.9285</td></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">Observations (or Sum Wgts)</td><td>40</td></tr>
</table><br>
<br>

<h3>Parameter Estimates</h3>

<table border=1 cellpadding=2 cellspacing=1>
<tr style="vertical-align:top" align=right><th bgcolor=#D9D9D9 align=left>Term</th><th bgcolor=#D9D9D9>Estimate</th><th bgcolor=#D9D9D9>Std Error</th><th bgcolor=#D9D9D9>ChiSquare</th><th bgcolor=#D9D9D9>Prob&gt;ChiSq</th></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">Intercept</td><td> -12.267957</td><td>5.9870108</td><td>4.20</td><td><font COLOR="#f03246">0.0405*</td></tr>
<tr style="vertical-align:top" align=right><td style="text-align:left">height</td><td>0.19939641</td><td>0.0954697</td><td>4.36</td><td><font COLOR="#f03246">0.0367*</td></tr>
</table><br>
<br>
<span style="font-size:9pt">For log odds of M/F</span><br>

</body></html>
Jim
Craige_Hales
Super User

Re: How to save report as a text file via script?

Two answers.

bv = Bivariate(
	Y( :weight ),
	X( :height ),
	Fit Line( {Line Color( {212, 73, 88} )} )
);

showproperties(bv);

rep = report(bv);

showproperties(rep);

rep<<savetext("$desktop/rep.txt"); // <<<<<<< this one

The bv is the platform object. The rep is the display box object. The displayboxes can save their text the way you want. The showproperties() shows all the messages that can be sent to an object. (The platform object is live and takes messages to add and remove analyses. The display boxes in the report hold static output.)

The second answer is what most of the other answers are suggesting: do some of the heavy lifting in JMP rather than parsing the text output later. I'd break it apart like this:

JMP --- JSON --- OtherProgram

Make JMP find and save the parameters in a standard file format, and make the other program read them that way.

Now you have a way to swap out programs on both ends as long as they produce/consume the same format. And when you upgrade from JMP 9 to 15 (soon 16), if the text has changed you don't have to rewrite OtherProgram, just (maybe) touch the JSL to extract the values into JSON. Or, if you choose a different platform in JMP to get the statistics, that works too.

 

Craige
Thierry_S
Super User

Re: How to save report as a text file via script?

Hi,
I now better understand what you are looking for. Based on this, could I suggest another approach: instead of saving the outputs of your analysis in a text file and then extract back what you need with another script, would it be more efficient to directly get the desired output from the report directly? If this is what you are trying to do, there are a couple of approaches I'd suggest:
1) Run your analyses and capture all your outputs into a single Journal. Then, manually, select the first table containing the results of interest and right-click on it and select "Make Combined Data Table"
2) Extract the content of the output report automatically via a script pointing to the desired element (use View Tree Structure to identify the right tables in your report).
If this is closer to what you are trying to obtain, I think that the JMP community could help you with the initial steps option #2,
Best,
TS
Thierry R. Sornasse