[EpiData-list] indexing records in epidatastat and retrieving values
EpiData development and support
epidata-list at lists.umanitoba.ca
Fri Apr 14 17:33:27 CDT 2017
To print the value of ill for the first sorted record, do this:
@ only gets the current value of the variable, which will always be the first value of a field, but then analysis is somewhat confused by the .
@ is normally used with global variables
in your example @ill *should* produce
at least it does in my test.
> On Apr 14, 2017, at 18:02, EpiData development and support <epidata-list at lists.umanitoba.ca> wrote:
> I am trying to retrieve value of variables based on other variables.
> Example: a dataset with 3 observations:
> # region_code ill
> 1 21 4
> 2 30 10
> 3 40 6
> i have tried the following:
> sort region_code
> gen i s =_n
> but i am getting the result of the last observation and not the first.
> I will be thankful if you advise on how to retrieve the value of a variable
> based on record indexing.
More information about the EpiData-list