BookmarkSubscribe
Choose Language Hide Translation Bar
AM
AM
New Contributor

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.

0 Kudos
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
0 Kudos
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
0 Kudos
AM
AM
New Contributor

Re: How to assign a number for a repeated measurement

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

0 Kudos
ron_horne
Super User

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.

 

 

0 Kudos