Operating on selected rows<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Hello Everyone,
Is it possible for me to operate a function on selected rows without using the FOR loop.
For example
k = dt<< Get Rows Where (pt:Parameter = ot:Parameter);
For (i=1,i<= Nrow(k),i++,
pt:value[k] = pt:value[k]/5; // I want the value of selected rows only to be divided by 5.
);
Is it possible for me to rewrite the code without using simple JMP function for it ? I dont like using too many for loops.
Thanks in advance!
regards,
Akash
Re: Operating on selected rowsIt causes JMP to pause for 3 seconds, and I inserted it so that you could see what's happening (run the code and look at the column called 'sex'). You can remove it of course.
Re: Operating on selected rowsHi Ian,
what does "Wait(3);" do in this context?
BR
Anders
Re: Operating on selected rowsThanks for replies.
Just that i deal with huge amounts of data and running loops for every action increase the processing time. I hope inbuilt functions/operators will be more optimized than me writing loops.
Re: Operating on selected rowsJust curious, why don't you like using loops?
Re: Operating on selected rowsOr try the "Divide To" assignment:
dt:height[k] /= 5
Re: Operating on selected rowsNamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Wait(3);
k = dt << getRowsWhere(:sex == "M");
h = Column(dt, "height") << getValues;
h[k] = h[k]*0.5;
Column(dt, "height") << setValues(h);