BookmarkSubscribeRSS Feed
saslover
Calcite | Level 5
How is it possible to determine the number of estrous cycles in dogs when the occurrence of the cycle is given.

For instance, when the determinants of the cycle is given by DI,PR,ES,ME,S,P where DI=diestrus,PR=Proestrus,ES=estrus,ME=metestrus,S=sperm,P=plug.

The occurrence of estrus is only that matters and the cycle is given by EST DI DI DI MET EST -- here the length of the cycle is 5 until the occurrence of next estrus.

A cycle is calculated from one estrus to another estrus. The length of the cycle is the period until next estrus occurs which is 5 in the above case.

How do I write a code to calculate this in Statistics. The endpoint is to calculate the number of cycles and length of each cycle.

The output has to look like this:
animal_id cycle1 cycle2 cycle3
101 5 3 2
102 2 3 1
103 3 1 2
6 REPLIES 6
Sudhakar_A
Calcite | Level 5
Give me an example how your data looks like..
saslover
Calcite | Level 5
It has many variables. But the variable of interest has observations that look like this

Est
Di
Met
Sp
Est

and so on
Sudhakar_A
Calcite | Level 5
Is there any other variables which is useful to keep the same order of the records even if you sort it.

we can do it 2 ways by transposing or in the dataset with common by variable.
Sudhakar_A
Calcite | Level 5
here you go

data hj;
input cat $15.;
datalines;
Est
Di
Met
Sp
Est
di
met
met
sp
gh
est
kk
lk
kk
jh
;
run;

data tjk;
set hj;
if upcase(cat)="EST" then newcy+1;
run;

proc freq data =tjk noprint;
tables newcy/out=tnum (drop=percent);
run;

proc transpose data=tnum out=tdurm prefix=cycle;
var count;
id newcy;
run;

if you want you can use the animal id as the by variable in all the steps

Sudhakar
saslover
Calcite | Level 5
I tried using your code.. but it has so many missing values and I would be unable to delete them.
Also the output has to look like this
animl_no cycle1 cycle2 cycle3
101 2 2 3

There are more than 400 cycles here, but in reality there are not more than 10 cycles. I have no clue how you get the 400 cycles.
Sudhakar_A
Calcite | Level 5
Can you give me the part of your observation with animal_id and other important variable which need to derive the cycle

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 6 replies
  • 2077 views
  • 0 likes
  • 2 in conversation