RE: Calculation person-year.

Reply
Contributor
Posts: 43

RE: Calculation person-year.

Hello everyone,

I am seeking SAS syntax for 'calculation person-year'. I am interested in looking an incidence rate of first stopping ARV in HIV populations.

I much appreciate anyone helps me with this concept.

Thanks in advance.

PROC Star
Posts: 7,363

Re: RE: Calculation person-year.

Couldn't you use the yrdif function (with the age option) to achieve what you want?  Take a look at:

http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p1pmmr2dtec...

Super User
Posts: 17,807

Re: RE: Calculation person-year.

I think the OP is looking for the epidemiological aspect of person-year, which usually means changing your data structure. But it depends on what format the data is in and what question you're asking.

http://meds.queensu.ca/medicine/obgyn/pdf/what_is/What.is.person-time.pdf

AFAIK There isn't a PROC that can do that for you, you'll need to write your own datastep to solve it.

Trusted Advisor
Posts: 2,113

Re: RE: Calculation person-year.

To follow up on Reeza and Art, the person-year of exposure to ARV would be the difference between the start of ARV and the first stopping (you can do with with yrdif or the approximate formula "(stopdate-startdate)/365.25".  To get the overall person-years of exposure, use PROC SUMMARY and get the sum.

Doc Muhlbaier

Duke

Contributor
Posts: 43

Re: RE: Calculation person-year.

Hello,

Thanks for your contribution. I will follow-up later.

Thanks

Phan

Contributor
Posts: 43

Re: RE: Calculation person-year.

Hello,

I do have the Eric document. I helps to understand the concept of person-year. I do agree with you that I have to write code my myself. At the meantime, I don't think I have never seen an example or taught about SAS syntax to apply for person-time.

It would be very helpful if any SAS experts can built an example for this issue for SAS users.

Thanks.

Phan

Trusted Advisor
Posts: 2,113

Re: RE: Calculation person-year.

Try this Google search, you'll see lots of examples

person-year calculation site:sas.com

PROC Star
Posts: 7,363

Re: RE: Calculation person-year.

Phan,

I've never worked in the area of epidemiological research, thus am not aware of the various nuances described in the reference that  Fareeza provided.  However, I'd be interested in knowing why a calculation similar to the calculation of age wouldn't be relevant.

The following mimics one of the examples from that reference:

/*

Time contributed by each subject:

Subject A: 2.5 years

Subject B: 5 years

Subject C: 1.5 years

Subject D: 5 years

Subject E: 0.5 years

*/

data have;

  informat initial_date onset_date date9.;

  format initial_date onset_date date9.;

  input subject $ initial_date onset_date;

  person_years=yrdif(initial_date, onset_date, 'AGE');

  cards;

A 01JAN2007 01JUL2009

B 01JAN2005 01JAN2010

C 01JAN2010 01JUL2011

D 01JUN2007 01JUN2012

E 01JUN2011 01DEC2011

;

: is that different from what the OP is seeking?

Super User
Posts: 17,807

Re: RE: Calculation person-year.

That will give you the person-years per person, but then you need the proc summary as suggested by doc@duke.

  I'm a She not a He Smiley Happy

Contributor
Posts: 43

Re: RE: Calculation person-year.

Dear Reeza,

My sincere apologies as I have difficulties with names. I appreciate and thank for your telling me.

Re. your advice, I will test later tonight and will follow-up.

Phan

Super Contributor
Posts: 1,636

Re: RE: Calculation person-year.

Hi Reeza,

I didn't know either!:smileysilly:  Together we are going to change the belief "over the years, males
have dominated the SAS guru level (quoted from Art)". :smileysilly:

PROC Star
Posts: 7,363

Re: RE: Calculation person-year.

and   When I made the comment I was speaking historically.  I've been studying all of the SAS-L postings that have been made since 1986.  Each year, over that period, the most frequent posters were male.

I don't know if that holds true on the forum, but definitely see a change since at least two of the five with the most points are female.

Contributor
Posts: 43

Re: RE: Calculation person-year.

Dear Art,

Many thanks for your follow-up. Through Reeze's comments, it appears that you are logic.

I may not have time to run a test at this moment, but will do tonight. I am happy to inform you.

Thanks,

Phan

Contributor
Posts: 43

Re: RE: Calculation person-year.

Dear Art,

I am not sure the 'calculation person-age' is similar to 'person-year' that Reeza has mentioned. He provides a useful document about the concept of 'person-year'.

I am trying to build SAS codes and I would like to share if I achieved.

Thanks,

Phan

Contributor
Posts: 43

Re: RE: Calculation person-year.

Dear Everyone,

My sincere apology that I couldn't get back last night.

To Art, I tested the yrdif (as well as dtdif) using methods/instructions from SAS Helps, unfortunately I had a message from log file: character values have been converted  to numeric values at the places given by ...

I am not sure what is wrong with the code.

Greatly, I used the approximate formula (doc@duke), it appears to be fine for my results.

As Reeze's comment, however, I need to develop several step fro proc summary, proc freq and proc mean to calculate 'sum' of variable that I need.

Overall, I think to calculate person-year is required several steps. These steps are very helpful for new SAS users like me.

One thing that I have no idea for Art is the code does not work. If possible, I will see a stat person in my place if he can help me to identify the erros.

At the meantime, I much appreciate and want to thank everyone in helping me this procedure. Again thanks.

Phan S. Smiley Happy

.

Ask a Question
Discussion stats
  • 22 replies
  • 4245 views
  • 6 likes
  • 5 in conversation