cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lala
Level IX

How to organize this non-standard form?

Thanks Experts! I'll just sort it out the stupid way and see if there's a better way.

dt = Current Data Table();
ca = "这";
Column( ca ) << Formula(
	If( Left( 是, 1 ) == "#",
		r = Row();
		a = Substitute( 是, "#", "" );
		"";
	,
		b = Row() - r;
		If( a != "拉丁" | a != "拉丁" | a != "假名" | a != "數字、分數",
			Word( b, a, "、" ),
			a || Munger( 是, 3, 1 )
		);
	)
);
dt << run formulas;
Column( ca ) << deleteFormula;

20240515223138.png

 

2 REPLIES 2
lala
Level IX

回复: How to organize this non-standard form?

The difficulty here is that the number of headings does not match the number of lines. Is there a better way to handle this?
Thanks!

2024-05-15_22-43-40.png

jthi
Super User

Re: How to organize this non-standard form?

I'm not exactly sure how you want to fill those rows but here is a guess

Names Default To Here(1);

dt = Open("$DOWNLOADS/symbols.jmp");
newcol = dt << New Column("header", Character, Nominal);
dt << Move Selected Columns(newcol, To First);
Column(dt, 2) << Set Name("symbol");

cur_headers = {};
cur_header = "";

dt << Begin Data Update;
For Each Row(dt,
	If(Starts With(:symbol, "#"), // Header row
		cur_headers = Words(:symbol, "#、");
		cur_header = "";
	,
		If(N Items(cur_headers) > 0,
			cur_header = Remove From(cur_headers, 1)[1];
		);
	);
	:header = cur_header;
);
dt << End Data Update;

jthi_0-1715786146076.png

 

-Jarmo

Recommended Articles