I have a longitudinal dataset in Stata in which IDs are repeated, I want to generate a new variable which repeats the number of IDs (like the column "visit" in the image). How can I write the code?
Generating a variable which records the number of repetitions
253 Views Asked by Lisa At
1
There are 1 best solutions below
Related Questions in STATA
- Backwards stepwise regression approach in Stata 13
- Stata: Retrieve variable label in a macro
- When was a file used by another program
- Rollreg and missing values in panel data
- Replace values within group
- Using varlist multiple times in Stata
- How do I stop SAS from adding an extra empty byte to every string variable when I use PROC EXPORT?
- Line chart with means and CIs in Stata
- Pairwise correlations over rolling periods ignoring double calculations
- How can I merge stacked, longitudinal datasets with string variable ID's in Stata?
- Drop random effects parameters from output table in Stata
- Adding across years
- how to: Separate a continuous variable by % proportions?
- How to loop through specific string values of a variable in Stata?
- read Excel cells into Stata global as variables
Related Questions in LONGITUDINAL
- Modeling longitudinal data with functional coefficients ignoring random effects
- Variance Covariance Matrix from Proc GLM
- How to deal with outliers within and between observations in a panel data in R?
- Remove entire observations that are outliers in panel data
- How do I get a count of participants with at least one observation at time point A and one observation at a later point on a different variable? - R
- TimeSeriesKMeans with more dimensions tslearn (more features/series)
- Using ggplot to reflect uneven spacing between time points
- Error in node T Invalid parent values: rjags dwsh distribution
- Mediation analysis with multiple mediators
- Group based trajectory modeling in R
- Does sim_slopes take into account random intercept in model?
- Can I match 2 data frames by a col, even if the data frames are of different length?
- Longitudinal dataset - difference between two dates
- lme4 1.1-27.1 error: pwrssUpdate did not converge in (maxit) iterations
- Panel data regression comparison in Matlab
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can use:
bysort ID : gen visit = _n