Hello,
I want to create a variable juridiction that identifies uniquely each juridiction. I have a micro dataset where the State, District and Primary Sample Units (PSU henceforth) are identified. Within a same district, three consecutive PSU belongs to a same juridiction. I already created a variable identifiying the rank of each PSU as follows :
bysort DISTNAME IDPSU : gen nvals = _n == 1
bysort DISTNAME : replace nvals = sum(nvals)
How can I indicate to Stata that every times "nvals" reaches a multiple of three, the variable juridiction should take a new value ?
thank you in advance
Chloé
Related Posts with tagging different groups when the number of observations is a multiple of three
How to generate wealth share of the top 10% in wealth distribution using weighted data?Dear Listers, I have data which provides me with information on wealth of each household. ID is the…
how to add up length of stays in hospital for certain hospitalizationshi all, I ve been trying to perform this task for a week now with no luck. I have a data set (each …
HelpI have country-wise GDP data from 1997 to 2016 how do I generate a country-wise 5 years forward movi…
Testing to see if the value of categorical variable x for string m contains the value of variable y for string m.Hello Statalist, Please forgive me if this is a stupid question; I am new to Stata. I am working wi…
generating a new variable in survey dataHi, I need to generate a new variable from the dataset that contains the number of children in the f…
Subscribe to:
Post Comments (Atom)
0 Response to tagging different groups when the number of observations is a multiple of three
Post a Comment