I have scoured statalist for some time but have not found the answer to this question.
First of all, here is my data:
Code:
input long id double tstamp float semid_min str11 exam 197143 1908625531000 1 "F_SF_ZK1" 197143 1908622351000 1 "F_SF_ZK1" 197143 1908625712000 1 "F_SF_ZK2" 197143 1908622431000 1 "F_SF_ZK2" 197143 1939971189000 2 "F_SF_HK1" 197143 1940086597000 2 "F_SF_HK1" 197143 1939713046000 2 "F_SF_PP" 197143 1940086743000 2 "F_SF_PP" 314527 1940087881000 1 "F_SF_HK1" 314527 1940087931000 1 "F_SF_HK1" 314527 1940088143000 1 "F_SF_PP" 314527 1940087991000 1 "F_SF_PP" 314527 1938762660000 1 "F_SF_ZK1" 361889 1877076918000 1 "F_SF_ZK1" 361889 1877077864000 1 "F_SF_ZK1" 361889 1892276506000 2 "F_SF_HK1" 361889 1892131466000 2 "F_SF_HK1" 361889 1892276389000 2 "F_SF_HK1" 361889 1892130877000 2 "F_SF_HK1" 361889 1894871347000 2 "F_SF_PP" 361889 1894871401000 2 "F_SF_PP" 361889 1894871610000 2 "F_SF_PP" 361889 1894871030000 2 "F_SF_PP" 361889 1908532174000 3 "F_SF_AP" 361889 1908532234000 3 "F_SF_AP"
24jun2020 12:46:30
I want to reshape observations from long to wide (I know this is quite a rare practice but I need to in this case unfortunately). This is my reshape code:
Code:
reshape wide grade extry sem tstamp, /// i(id semid_min) j(exam) string
Two exams that have been passed on the same day by the same person (as indicated by variables tstamp and id respectively) are genuine duplicates and must be dropped.
Therefore, I would like to create a variable identifying duplicates as defined by id and tstamp, and then drop these duplicate observations. Any ideas?
0 Response to Defining duplicates through extracting day from date-time variable
Post a Comment