Subscribe Bookmark RSS Feed

assigning column modeling type

I'm new to the world of JMP and trying to teach myself scripting by creating some simple but useful scripts. I am currently trying to automate the process of changing the column types in a sheet to match those in a reference file. I know that the easy way to do this is to recreate the table and correctly import it or to change the formats by hand - but where is the fun / value in that?

I have a simple script that will read the modeling format of the columns in the 2 tables and tell me when they are different (and how they differ) but I'm failing at the point of actually comparing the format against a specifically defined type (e.g. "Continuous") or resetting the column formats. I am reading the current modeling type into a variable and trying to reassign this variable to a different column... but failing. I assume it's a simple format issue and that someone out there knows an easy answer :-)
4 REPLIES
mpb

Super User

Joined:

Jun 23, 2011

This example doesn't do exactly what you want, but should point the way:



//Example toggles modeling type for a column and assigns it to another
column;

dt = open("$SAMPLE_DATA/fitness.jmp");



col1 = Column( dt, "Weight" );

modtype = col1 << get modeling type;

Show( col1, modtype );



col2 = Column( dt, "Oxy");



If( modtype == "Continuous",

    col1 << set modeling type(
"Nominal" ),

    col1 << set modeling type(
"Continuous" )

);

modtype = col1 << get modeling type;

col2 << set modeling type(eval(modtype));



Show( col1, col2, modtype );

Message was edited by: mpb
Thanks for that - I've almost got it working... but not quite!

The code I have so far is :

/* COMPARE THE column types OF TWO DATA TABLES */
/* NB: Assumes columns are in the same order and have the same name */
caption("Please locate the reference data table.");
dt1=open("reference_table.jmp");
caption(remove);
caption("Please locate the data table to be corrected.");
dt2=open("table2fix.jmp");
caption(remove);
nc = min(ncol(dt1),ncol(dt2));
// Check for differing column types.
for(j=1,j<=nc,j++,
current data table(dt1);
n1=ColumnName(j);
t1=Column(j) << get data type;
m1=Column(j) << get modeling type;
colln1 = column(dt1, j );
current data table(dt2);
n2=ColumnName(j);
t2=Column(j) << get data type;
m2=Column(j) << get modeling type;

if(and(n1==n2,t1!=t2,m1!=m2),
write("\!rDiffering column types in column "||char(j));
current data table(dt2);
if( m1 == "Continuous", print("Continuous found");
write("\!rColumn name=",n1,"| data type 1 =",t1," | modeling type 1 = ",m1);
write("\!rColumn name=",n1,"| data type 2 =",t2," | modeling type 2 = ",m2);
current data table(dt2);
colln1 << set data type(eval(t1)) ; //Doesn't actually do anything
colln1 << set modeling type((m1)) ;
/* Column("R") << data type( numeric ) << modeling type( continuous ); //This row works */
);
show("M1 = "||m1);
); //end of if

); // end of for
;
;

It almost works. All of the variables display correctly and it compiles, and steps through the loop perfectly but... it has no effect on the actual column type in the sheet! Where have I gone wrong?
mpb

Super User

Joined:

Jun 23, 2011

I think I have properly reconstructed your code though I have commented out the 2 write statements that caused syntax errors I didn't have time to track down.

If this indeed represents what you coded, then it looks to me as if you are setting the column in table 1 to have data and modeling types you got from the same table whereas I assume you mean to change the column in table 2. See if that makes a difference. You need an appropriately placed line: colln2 = Column( dt2, j ); and then send your messages to colln2.




style="font-size: 10pt; font-family: "Courier New"; color: green;">/*
COMPARE THE column types OF
TWO DATA TABLES */

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: green;">/*
NB: Assumes columns are in the
same order and have





style="font-size: 10pt; font-family: "Courier New"; color: green;">the
same name */

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Caption

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"Please
locate the reference data table."

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">dt1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Open

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"reference_table.jmp"

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Caption

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">remove

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Caption

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"Please
locate the data table to be corrected."

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">dt2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Open

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"table2fix.jmp"

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Caption

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">remove

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">nc

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Min

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">N
Col

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt1 )

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">N
Col

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt2 )
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: green;">//
Check for differing column
types.

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: teal;">1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
nc

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Current
Data
Table

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt1 )

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
n1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Column
Name

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
t1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
get data type

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
m1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
get modeling
type

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
colln1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Current
Data
Table

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt2 )

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
n2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Column
Name

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
t2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
get data type

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
m2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
get modeling
type

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">If

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">And

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
n1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">==

style="font-size: 10pt; font-family: "Courier New"; color: black;">
n2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
t1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">!=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
t2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
m1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">!=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
m2 )

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">           

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Write

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"\!rDiffering
column types in column "

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: navy;">||

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Char

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">           

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Current
Data
Table

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt2 )

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">           

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">If

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
m1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">==

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"Continuous"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">                 

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Print

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"Continuous
found"

style="font-size: 10pt; font-family: "Courier New"; color: black;">
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">                 

style="font-size: 10pt; font-family: "Courier New"; color: green;">//write("\!rColumn
name=",n1,"| data type 1 =",t1,"1," | modeling type 1
= ",m1);

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">                 

style="font-size: 10pt; font-family: "Courier New"; color: green;">//write("\!rColumn
name=",n1,"| data type 2 =",t2,"2," | modeling type 2
= ",m2);

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">                 

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Current
Data
Table

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt2 )

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">                 
colln1

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
set data type(

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Eval

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">
t1 )
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">
              

style="font-size: 10pt; font-family: "Courier New"; color: green;">//Doesn't
actually do anything

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">                 
colln1

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
set modeling
type(
(m1)
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: green;">/*
style="">               
Column("R") <<
data type( numeric )
<< modeling type( continuous ); //This row works
style=""> 
*/

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">           
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">           

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Show

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"M1
=
"

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: navy;">||

style="font-size: 10pt; font-family: "Courier New"; color: black;">
m1 )

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     
)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">
style=""> 

style="font-size: 10pt; font-family: "Courier New"; color: green;">//end
of if

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">           




style="font-size: 10pt; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">
style=""> 

style="font-size: 10pt; font-family: "Courier New"; color: green;">//
end of for

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: navy;">;
for(j=1,j<=nc,j++,
current data table(dt1);
n1=ColumnName(j);
t1=Column(j) << get data type;
m1=Column(j) << get modeling type;
colln1 = column(dt1, j );
current data table(dt2);
n2=ColumnName(j);
t2=Column(j) << get data type;
m2=Column(j) << get modeling type;

if(and(n1==n2,t1!=t2,m1!=m2),
write("\!rDiffering column types in column "||char(j));
current data table(dt2);
if( m1 == "Continuous", print("Continuous found");
write("\!rColumn name=",n1,"| data type 1 =",t1," | modeling type 1 = ",m1);
write("\!rColumn name=",n1,"| data type 2 =",t2," | modeling type 2 = ",m2);
current data table(dt2);
colln1 << set data type(eval(t1)) ; //Doesn't actually do anything
colln1 << set modeling type((m1)) ;
/* Column("R") << data type( numeric ) << modeling type( continuous ); //This row works */
);
show("M1 = "||m1);
); //end of if

); // end of for
;
;

It almost works. All of the variables display correctly and it compiles, and steps through the loop perfectly but... it has no effect on the actual column type in the sheet! Where have I gone wrong?