BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
clausa

Community Trekker

Joined:

Jan 16, 2014

JSL Multiple Response Value Labels Column Name vs Number

I have a data set that came from a .pkd file with multiple response columns with value labels. Depending on how I reference the column, I get different results.

 

Show( Column( 101 ) << get property( "value labels" ) );
Show( Column( 101 ) << get name );
Show( Column( :name( "TestMR" ) ) << get property( "value labels" ) );


//results
Column(101) << get property("value labels") = Value Labels({"10" = "A", "100" = "B", "101" = "C"});
Column(101) << get name = "TestMR";
Column(:TestMR) << get property("value labels") = Value Labels({-2 = "Not at all Important (-2)", -1 = "Not Important (-1)", 0 = "Neither Important nor Unimportant (0)", 1 = "Important (1)", 2 = "Effective Base Used For Stat Testing Weighted Data", 9 = "Not answer"});
4 REPLIES 4
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Re: JSL Multiple Response Value Labels Column Name vs Number

It's hard to tell from your code snippet but a guess is that you're not referencing the same data table in each case.

 

Do you have more than one data table open?

 

Try scoping both references to ensure you're getting them from the same data table.

 

 

 

dt1=open("$SAMPLE_DATA\Big Class.jmp");
dt2=open("$SAMPLE_DATA\Fitness.jmp");

show(column(dt1,2)<<get name);
show(column(dt2,3)<< get name);

show(dt1:age<<get modeling type);
show(dt2:age<<get modeling type);
-Jeff
clausa

Community Trekker

Joined:

Jan 16, 2014

Re: JSL Multiple Response Value Labels Column Name vs Number

Only 1 data table open, and coded in a dt=current data table(). Interesting when I run the last bit of your code I get two different modeling types

 

Column(dt, 101) << get modeling type = "Multiple Response";
Column(dt, :TestMR) << get modeling type = "Ordinal";
clausa

Community Trekker

Joined:

Jan 16, 2014

Re: JSL Multiple Response Value Labels Column Name vs Number

In efforts to create a scrubbed file that I can post, I ended up writing doing the following and have more questions than answers now:

 

dt = Current Data Table();
Show( Column( dt, 101 ) << get modeling type );
Show( Column( dt, "TestMR"  ) << get modeling type );
Show( Column( dt, :name("TestMR")  ) << get modeling type );
For( a = 1, a <= 550, a++,
	If( a != 101,
		a1 = Random Integer( 26 );
		a2 = Random Integer( 26 );
		a3 = Random Integer( 26 );
		a4 = Random Integer( 26 );
		a5 = Random Integer( 26 );
		a6 = Random Integer( 26 );
		a7 = Random Integer( 26 );
		a8 = Random Integer( 26 );
		alpha = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W",
		"X", "Y", "Z"};
		temp = alpha[a1] || alpha[a2] || alpha[a3] || alpha[a4] || alpha[a5] || alpha[a6] || alpha[a7] || alpha[a8];

		Column(dt, a ) << set name( temp );
	)
);
Show( Column( dt, 101 ) << get modeling type );
Show( Column( dt, "TestMR"  ) << get modeling type );
Show( Column( dt, :name("TestMR")  ) << get modeling type );

and I get

Column(dt, 101) << get modeling type = "Multiple Response";
Column(dt, "TestMR") << get modeling type = "Multiple Response";
Column(dt, :TestMR) << get modeling type = "Ordinal";
Column(dt, 101) << get modeling type = "Multiple Response";
Column(dt, "TestMR") << get modeling type = "Multiple Response";
could not find column in access or evaluation of 'Column' , Column/*###*/(dt, :TestMR)

In the following script, error marked by /*###*/
dt = Current Data Table();
Show( Column( dt, 101 ) << get modeling type );
Show( Column( dt, "TestMR" ) << get modeling type );
Show( Column( dt, :TestMR ) << get modeling type );
For( a = 1, a <= 550, a++,
	If( a != 101,
		a1 = Random Integer( 26 );
		a2 = Random Integer( 26 );
		a3 = Random Integer( 26 );
		a4 = Random Integer( 26 );
		a5 = Random Integer( 26 );
		a6 = Random Integer( 26 );
		a7 = Random Integer( 26 );
		a8 = Random Integer( 26 );
		alpha = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
		"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
		temp = alpha[a1] || alpha[a2] || alpha[a3] || alpha[a4] || alpha[a5] ||
		alpha[a6] || alpha[a7] || alpha[a8];
		Column( dt, a ) << set name( temp );
	)
);
Show( Column( dt, 101 ) << get modeling type );
Show( Column( dt, "TestMR" ) << get modeling type );
Show( Column/*###*/(dt, :TestMR) << get modeling type );

I checked the column is still named "TestMR". Tried editing it and going back, still doesn't change. There seems to be something with using the syntax of ":name()" but I cannot figure it out

Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Re: JSL Multiple Response Value Labels Column Name vs Number

The error you received above is because the Column() function takes either a column number or name as a quoted string, so you can't use :TestMR in the Column() function.

 

The fact that you get two different modeling types is very interesting and makes it seem like you're referring to two different columns.

 

We need to look at the columns referred to by:

 

 

Column(dt, 101);
//and
Column(dt, "TestMR");

So, let's try something like this:

 

column(dt, 101)<<set selected(1);
dt<<subset(selected columns(1));

column(dt, "TestMR")<<set selected(1);
dt<<subset(selected columns(1));

Then look at the two subset tables and see if it's the same column.

 

 

 

 

-Jeff