cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
lwx228
Level VIII

How do I insert a row at the top of the table and compute the percentage of negative Numbers for the

There are multiple rows and columns in the table. Can you insert a row above the first row and calculate the percentage of negative Numbers in the same column?The effect is shown below.

 

2018-08-26_21-26-23.png

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

Generally, it's a bad idea to have data of different levels of granularity held in the same table. Additionally (like other statistical software) JMP requires data in a column to be of the same data type, modeling type and format.

 

But, so long as you don't mind a proportion rather than a percentage, if you want to do this you could use JSL:

 

NamesDefaultToHere(1);

// (1) Make some data
nr = 10;	// Number of rows
nc = 5;		// Number of columns
dt = NewTable("Data");
for (c = 1, c<=nc, c++, dt << NewColumn("Col "||Char(c), Formula(RandomINteger(-10, 10))));
dt << addRows(nr);
dt << runFormulas;
for (c = 1, c<=nc, c++, Column(dt, c) << deleteFormula);

// (2) Insert a new first row
dt << addRows(1, atStart);

// (3) Populate values of first row
for (c=1, c<=NCols(dt), c++,
	vals = Column(dt, c) << getValues;
	vals = vals[2::NRows(dt)];
	Column(dt, c)[1] = NRows(Loc(vals < 0))/(NRows(dt)-1);
);

 

View solution in original post

7 REPLIES 7
lwx228
Level VIII

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

It's done with JSL, thanks!
lwx228
Level VIII

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

The new inserted row format may not be in the percentage format.
Thierry_S
Super User

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

Hi, 

 

This might not be the most efficient way to handle your specific issue but unlike Excel, JMP does not easily allow for calculations in specific rows as you mentioned. Hence, would it be an option to transpose your table (columns A, B, C, D become rows with 11 columns of data) in which you could add an Average column.

 

Just a thought. 

 

Best regards,

 

TS

Thierry R. Sornasse
ian_jmp
Level X

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

Generally, it's a bad idea to have data of different levels of granularity held in the same table. Additionally (like other statistical software) JMP requires data in a column to be of the same data type, modeling type and format.

 

But, so long as you don't mind a proportion rather than a percentage, if you want to do this you could use JSL:

 

NamesDefaultToHere(1);

// (1) Make some data
nr = 10;	// Number of rows
nc = 5;		// Number of columns
dt = NewTable("Data");
for (c = 1, c<=nc, c++, dt << NewColumn("Col "||Char(c), Formula(RandomINteger(-10, 10))));
dt << addRows(nr);
dt << runFormulas;
for (c = 1, c<=nc, c++, Column(dt, c) << deleteFormula);

// (2) Insert a new first row
dt << addRows(1, atStart);

// (3) Populate values of first row
for (c=1, c<=NCols(dt), c++,
	vals = Column(dt, c) << getValues;
	vals = vals[2::NRows(dt)];
	Column(dt, c)[1] = NRows(Loc(vals < 0))/(NRows(dt)-1);
);

 

lwx228
Level VIII

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

Thank you very much! That's what's needed.See the figure of VBA cycle.
Craige_Hales
Super User

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

Transpose might be a good idea, especially for labeling the percentages.

You might still want to work with untransposed data, particularly if the number of rows is not always the same.

You can insert a row above, like this

 

dt<<addrows(1,at start);

and you can fill it in with the percentages. But after you do that the columns won't be useful with the JMP analysis platforms that expect the data in a column to all be the same kind of data. 

To give a better answer, we need to know what the next step is: is this the final presentation (tabulate, perhaps), or is there more analysis planned for the table and the percentages (another table might help)? Will the data be updated (maybe use column formulas)?

 

 

Craige
lwx228
Level VIII

Re: How do I insert a row at the top of the table and compute the percentage of negative Numbers for

Different results are obtained by using the JMP model operation, and further processing of these results is not available for direct use by the JMP module.I always have to go to VBA and do my calculations.Lincoln That went well.