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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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