cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
AM
AM
Level I

How to assign a number for a repeated measurement

Hi,

I have a dt with measurements of vital signs repeated three times at a visit for each subject.:

Subjects Vital SignsResultvisitRepetition
1Dias601a
1Dias651b
1Dias621c
1Sys 1221a
1Sys 1201b
1Sys 1251c
1Pul721a
1Pul741b
1Pul771c
2Dias651a
...................

 

I would like to write a formula that calculates repetitions for vital signs measurements in a new column (e.g. repetition a, b, c). What would be the best way to assign those values?

Thank you in advance forhelp.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to assign a number for a repeated measurement

If making the Repetition a numeric value is an option, then you could simply create the new column, and then go to Col Info, and under "Initialize Data" select "Sequence Data" and then specify a sequence of 1 to 3

repetiition1.PNG 

Or you could create the formula

theList = {"a", "b", "c"};
If( Mod( Row(), 3 ) > 0,
	theList[Mod( Row(), 3 )],
	theList[3]
);

Make sure the column is defined as a Character column to use the above formula

Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How to assign a number for a repeated measurement

If making the Repetition a numeric value is an option, then you could simply create the new column, and then go to Col Info, and under "Initialize Data" select "Sequence Data" and then specify a sequence of 1 to 3

repetiition1.PNG 

Or you could create the formula

theList = {"a", "b", "c"};
If( Mod( Row(), 3 ) > 0,
	theList[Mod( Row(), 3 )],
	theList[3]
);

Make sure the column is defined as a Character column to use the above formula

Jim
AM
AM
Level I

Re: How to assign a number for a repeated measurement

Thank you! It works perfectly. Have a nice day.

ron_horne
Super User (Alumni)

Re: How to assign a number for a repeated measurement

hi @AM ,

@txnelson gave a good clean solution for your question. But if your data is actually more complicated have a look at the following

https://community.jmp.com/t5/Discussions/Syntax-How-do-I-create-an-index-column-by-ID/m-p/9751/highl...

it does the same but in a more robust way managing messy data sets.