DATA Step, Macro, Functions and more

Reorganizing data within subjects in a datafile

Reply
Contributor
Posts: 58

Reorganizing data within subjects in a datafile

Hello All,

I need to reorganize a data set such that observations within subjects can be reordered by date.

The data set looks like this:

Subject_ID  Follow_Up_Time  Interview_Date  Previous_Interview_Date  Adverse_Event_Report_Date

1  1  Feb10  Jan10  Nov10

1  2  Mar10  Feb10  .

1  3  Dec10  Nov10  .

2  1  Jun10  May10  May10

2  2  Jul10  Jun10  Jan11

2  3  Feb11  Jan11  .

The last variable in the data set is not correctly assigned to its corresponding time period (i.e, Adverse_Event_Report_Date should be within the period between Interview_Date and Previous_Interview_Date). For example, in the first case line, the Adverse_Event_Report_Date variable should be missing and should appear in the third row for Subject_ID = 1. I

Please advice on the data steps required to restructure this data file.

Thank you in advance.

Sincerely,

Pronabesh

Ask a Question
Discussion stats
  • 0 replies
  • 136 views
  • 0 likes
  • 1 in conversation