BookmarkSubscribeRSS Feed
art297
Opal | Level 21

Phan,

I failed to mention that the code I suggested requires SAS 9.3.  I presume you are on an older version.

PhanS
Obsidian | Level 7

Dear Art,

Thanks for the follow-up. Indeed, I am working on 9.3.

In fact, this message from log file: character values have been converted  to numeric values at the places given by ... referred for another (I'm sorry to confuse you).

Lately, I will send you a log file that may help you to understand the issue when I ran the code.

I am in Vancouver, a bit inconvenience at my workplace for Internet.

Phan

art297
Opal | Level 21

Not a problem.  I'm in Toronto thus at least your response won't have to go through Customs.

PhanS
Obsidian | Level 7

Dear Art,

Please kindly see the log. I will see a stat person tomorrow morning and will fu you.

8617  /*person-year*/

8618  py_dead1=yrdif(farvdt, death_date, 'act/act');

8619  py_dead2=datdif(farvdt, death_date, 'act/act');

8620

8621

8626  run;

NOTE: Invalid argument to function YRDIF at line 8618 column 10.

NOTE: Invalid argument to function DATDIF at line 8619 column 10.

Thanks,

Phan

art297
Opal | Level 21

Are both farvdt and death_date SAS date fields?  All three of the following work for me:

data have;

  informat farvdt death_date date9.;

  input farvdt death_date;

  /*person-year*/

  py_dead1=yrdif(farvdt, death_date, 'act/act');

  py_dead2=datdif(farvdt, death_date, 'act/act');

  py_dead3=yrdif(farvdt, death_date, 'age');

  cards;

1jan2010 10may2012

10jun2011 25oct2012

;

PhanS
Obsidian | Level 7

Dear Art, good morning!

Pls. kindly see the date SAS. I will fu with you late today, I hope to show the issue to my colleague. Thanks.

Phan

                                                   DEATH_

                       Obs     ID FARVDT              DATE

                        16     310 01MAR2010            .

                        17     340 28APR2008            .

                        18     350 22NOV2006    27MAR2008

                        19     360 23FEB2004            .

                        20     370 07OCT2009            .



art297
Opal | Level 21

You would get the error due to the missing dates.  What date would you base person_years on for someone who hasn't died?

PhanS
Obsidian | Level 7

Dear Art,

You are absolutely correct!

I use another date (as this dataset is a bit confusion) the dead_date do not reflect for death and I am asked to use fu_time. And the code work fine.

I much appreciate and thank you very much, Art, and thanks everyone's times for discussion.

Phan S. Smiley Happy

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 22 replies
  • 11074 views
  • 6 likes
  • 5 in conversation