Jim:
This code employs the Munger command to find the location
of the
substring and then computes the next test location and
THEN incriments a counter !
Use the "for each row" loop to create a script
to do this for each and every row !!!
see the scripting manual table 3.12 and pg 16 in the 5.1
scripting guide, which gives some
examples.
enjoy !
substr = "C1ccC1";
len1 = length("C1ccC1");
str1 = "C1ccC1snbdmasdbC1ccC1mnasbdmC1ccC1manbdsC1ccC1";
S1 = Munger(str1, 1,"C1ccC1");
show(len1);
i =0;
count = 0;
while(i<length(str1),
location = Munger(str1, i, substr);
count = count+1;
i = location + len1;
show(i);
show(location);
show(count);
);
Donald Palahnuk
Sen Engr, Proc Sci
ImClone Systems |
D Palahnuk
Senior Engineer, Process Sciences
ImClone Systems
908 252 3533
Donald.Palahnuk@ImClone.com
There is 1 message in this
issue.
Topics in this digest:
1. Need JMP formula to count occurrence of a particular
character or
characters in a string
From: "James T Metz" <james.metz@abbott.com>
________________________________________________________________________
________________________________________________________________________
Message: 1
Date: Thu, 21 Apr 2005 11:31:20 -0500
From: "James T Metz" <james.metz@abbott.com>
Subject: Need JMP formula to count occurrence of a particular character
or
characters in a string
JMP Users,
Can someone please help.
I am trying to create a JMP formula which will
count the
occurence(s) of a character or small group of characters in
a string. For example, I would like to count the number of "{"
left
squiggle braces in a character string.
Another example, I would like to be able to
count the number of
occurences of "C1ccC1" in a character string.
I would be most grateful if someone could figure
out a row formula
how to do this.
Thank you.
Regards,
Jim Metz
James T. Metz, Ph.D.
Research Investigator Chemist
GPRD R46Y AP10-2
Abbott Laboratories
100 Abbott Park Road
Abbott Park, IL 60064-6100
U.S.A.
Office (847) 936 - 0441
FAX (847) 935 - 0548
james.metz@abbott.com
This communication may contain information that is legally privileged,
confidential, or exempt from disclosure. If you are not the intended
recipient, please note that any dissemination, distribution, use, or
copying of this communication is strictly prohibited. Anyone who
receives
this message in error should notify the sender immediately by telephone
or
return email and delete it from his or her computer.
|
Confidentiality Note: This e-mail, and any attachment to it, contains
privileged and confidential information intended only for the use of the
individual(s) or entity named on the e-mail. If the reader of this
e-mail is not the intended recipient, or the employee or agent responsible
for delivering it to the intended recipient, you are hereby notified that
reading it is strictly prohibited. If you have received this e-mail
in error, please immediately return it to the sender and delete it from
your system. Thank you.
|