Col sum filling issueI am trying to fill in a column with the sum of another column given a certain condition.
For instance:
dt = open("$sample_data/big class.jmp");
dt = New column("value",numeric,formula(col sum(:height, :sex=="F")));The new column "value" results in two values (1096 for Females and 1406 for Males). I would like the entire column to have the 1096.
I am using JMP Pro 14.1
Re: Col sum filling issueThis is what I was looking for. Thank you!
Re: Col sum filling issueI think this will do what you want
dt = open("$sample_data/big class.jmp");
dt = New column("value",numeric,formula(col sum(If(:Sex == "F",:height, .))));Re: Col sum filling issueYour discreption is missing some of the conditions you are interested in, but here is one way to solve it:
dt = open("$sample_data/big class.jmp");
dtsum = dt << Summary(
Group( :sex ),
Sum( :height ),
Freq( "None" ),
Weight( "None" )
);
ValueYouWant = Column(dtsum,"Sum(height)")[1];
Close(dtsum, No save);
NewValues = J(n rows(dt),1,ValueYouWant);
dt = New column("value",numeric,Set Values( NewValues ));