BookmarkSubscribeRSS Feed
Sinakian1
Fluorite | Level 6

Hi Everyone, 

 

I would appreciate if you could please help me with the following question. 

 

 

What I have: 

I have three variables, Year_of_visit, employment status (UNEMP), and HIV_ status. I also have 5 participants. Participants were asked about their employment status in different years. When the UNEMP is 0 it means the person is employed and when it is 1 it means the person is not employed. In each year of visit, they were also tested for HIV status. If HIV test is 0 then the person is not infected if HIV_status is 1 then they are infected. 

 

What I want: 

I am conducting a survival analysis (using PROC PHREG) on the association between the Unemployment (UNEMP) and HIV outcome. However, the employment status of participants changes in different years. For instance, Case ID 1 is employed in years 2000 and 2001, then she was unemployed in years 2002 and 2003, and finally, she became employed again in 2004. Hence, the Unemp variable is time-dependent and changes over time. I want to make a third time-dependent variable based on UNEMP variable, which takes into account the time dependency of Unemp. Then I am going to use that variable in Proc Phreg analysis. 

 

Thank you indeed for your help. Below is a code for what I have. 

 

Data what_I_Have; 

input CASE_ID Year_of_visit UNEMP HIV_Status ;

Datalines;

1 2000 0 0

1 2001 0 0

1 2002 1 0

1 2003 1 1

1 2004 0 1

2 2000 0 0

2 2001 0 1

2 2002 1 1

2 2003 1 1

2 2004 1 1

2 2005 1 1

3 2000 1 0

3 2001 1 0

4 2000 1 0

4 2001 0 0

5 2000 1 0

5 2001 1 0

5 2002 0 1

5 2003 1 1

;

 

2 REPLIES 2
andreas_lds
Jade | Level 19

Sorry, but i don't understand what "time-dependent" means. Please explain what the variable should contain.

Sinakian1
Fluorite | Level 6
I only have 5 participants (Case Ids 1 to 5). But, there are more than 5 observations because each participant answer's to the question "are you employed currently?" changed over time. I want to take this change into account when doing the Proc Phreg. Thank you

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1157 views
  • 0 likes
  • 2 in conversation