Choose Language Hide Translation Bar
Highlighted
ENTHU
Level III

Issue with summarize

Set value gives empty column.Can anyone help to understand why this is happening?

 

dt << Select Where( :building != 4 | :Flag != "Y" ) << exclude;
Summarize( dt, building = Count() );
Show( building ); // shows the right value but the value is not printed to the column in the Temp table.

dt_1 = New Table( "Temp", invisible );
dt_1 << New Column( "building", Character, set values( building ) );

 

1 REPLY 1
Highlighted
gzmorgan0
Super User

Re: Issue with summarize

@ENTHU ,

 

There are several issues with your script.  

  • After your select logic and exclusion only building ==4 and Flag == "Y" remains, summarize returns a scalar, not a list of values. The column values argument requires a list.
  • The temp table building column is specified as character, yet your value is numeric

Note I did not specify the table to be invisible so you can see the result

Names Default to Here(1);

dt = New Table("Random", add rows(300),
        New Column("building", numeric, <<set each value(Random Integer(1,6)) ),
        New Column("Flag", character, <<set each value(If(Random Uniform()< 0.5, "Y", "N")))
     );
     
(dt << Select Where( :building != 4 | :Flag != "Y")) << exclude;
Summarize( dt , building = Count() );
show(building); // shows the right value but the value is not printed to the column in the Temp table.

dt_1 = New Table( "Temp");
dt_1 << New Column( "building", numeric, set values( EvalList(list(building)) ) );

 Caution: JMP is good with naming conventions, however, this script could easiy create a name collision. You are using building as a name for 3 objects: two columns in different tables and a variable, in other words,

  1. dt:building
  2. dt_1:building
  3. here:building  or ::building if Names Default to Here() is unspecified
Article Labels