cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • See how to interactively organize and restructure data for analysis. Register for May 29 webinar, 2pm US ET.

Discussions

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

How I can change the data type from "continous" to "characters" from all the columns in current data table in one JSL sentence ?


For each column(
	col,
	dt,
	If( col << Get Modeling Type == "continous" & Contains( col << Get Name, "Layer Count" ),
		col << Set Data Type( Character )
	)
);

I tried to ask AI, then i get some proposals, above is one sample, but it is not work. my version is JMP 18

2 REPLIES 2
jthi
Super User

Re: How I can change the data type from "continous" to "characters" from all the columns in current data table in one JSL sentence ?

AI is quite bad with JSL, Scripting Index or using JMP to create example script is much better. 

Here is basic example

For Each({colname}, Current Data Table() << Get Column Names("Continuous", "String"),
	Column(Current Data Table(), colname) << Set Data Type("Character");
);

JMP created script

jthi_0-1745315607021.png

jthi_1-1745315633594.png

// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("Big Class"));
	For Each({col, index}, {:name, :age, :sex, :height, :weight},
		col << Set Data Type(Character(7)) << Set Modeling Type("Nominal") <<
		Compact()
	);
	Current Data Table(old dt);
);
-Jarmo
Sean_ShCn0
Level II

Re: How I can change the data type from "continous" to "characters" from all the columns in current data table in one JSL sentence ?

It works, I learn a new skill, thanks.

 

KR

Sean

Recommended Articles