Hi everyone,
I am having a problem with flagging an index variable. I want to flag the lowest value for a given variable, nrd_daystoevent, within a group, nrd_visitlink.
My sample codes are below:
*I installed ssc inst unique to use the egen nvals ( ) function
egen uniq_daystoevent = nvals(nrd_daystoevent), by(nrd_visitlink)
My output is below:
nrd_visitlink nrd_daystoevent uniq_daystoevent
000029 17609 1
00008o 15782 2
00008o 15828 2
00009m 14265 2
00009m 14287 2
0000et 15664 1
0000tb 19796 3
0000tb 19825 3
0000tb 19889 3
What I want is for there to be only ONE flag (in the uniq_daystoevent variable) and not multiple flags. So in the output above, I would want nrd_visitlink 00008o to have a flag for the value '15782' since this value is lower than '15828'
Thank you in advance for the help!
I am having a problem with flagging an index variable. I want to flag the lowest value for a given variable, nrd_daystoevent, within a group, nrd_visitlink.
My sample codes are below:
*I installed ssc inst unique to use the egen nvals ( ) function
egen uniq_daystoevent = nvals(nrd_daystoevent), by(nrd_visitlink)
My output is below:
nrd_visitlink nrd_daystoevent uniq_daystoevent
000029 17609 1
00008o 15782 2
00008o 15828 2
00009m 14265 2
00009m 14287 2
0000et 15664 1
0000tb 19796 3
0000tb 19825 3
0000tb 19889 3
What I want is for there to be only ONE flag (in the uniq_daystoevent variable) and not multiple flags. So in the output above, I would want nrd_visitlink 00008o to have a flag for the value '15782' since this value is lower than '15828'
Thank you in advance for the help!
Comment