Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
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 Signs Result visit Repetition 1 Dias 60 1 a 1 Dias 65 1 b 1 Dias 62 1 c 1 Sys 122 1 a 1 Sys 120 1 b 1 Sys 125 1 c 1 Pul 72 1 a 1 Pul 74 1 b 1 Pul 77 1 c 2 Dias 65 1 a .... ... .... .... ....

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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

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
3 REPLIES 3
Highlighted
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

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
Highlighted
Level I

## Re: How to assign a number for a repeated measurement

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

Highlighted
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.

Article Labels

There are no labels assigned to this post.