Hi everyone, this is my first post to Statalist so I kindly request some patience as well as welcome feedback regarding my post format.
I had a long database that I have reshaped to wide.
This is my reshape code:
Array Accordingly, this has generated multiple age and multiple sex variables per observation (e.g. age1, age2, age3), whereas in the original long format, I only had one age and one sex variable per observation. Below you can see an example which also offers more details regarding the storage types, etc.
Array
I would like to merge the age variables into one per observation. I would also like to do the same for the multiple sex variables.
I am also having trouble knowing exactly which term to use to address this issue (i.e. I am still learning the language of STATA). For example, having done my own research, I've learned that I am NOT looking to stack or concatenate (as this would require I reshape back to long).
I therefore have two questions:
1. Can someone please confirm I am looking to MERGE these variables into one new variable #STATALanguage?
2. Can someone please offer guidance as to how I can accomplish this.
Kind regards,
Kate
Related Posts with Merging variables into one variable after rehaping
time series regressions for a portfolioDear all For a project we have to use performance regression to estimate whether a portfolio delive…
Setting version, seed, and sortseed not sufficient for reproducibility?The following code appears to produce different results depending on the Stata 16.1 edition I use. …
Problems creating a single variable that represents the different conditions of my experimentHi all, For my Master thesis, I used Qualtrics for an online experiment and within this experiment …
MFX table logit commandHi all, I'm fairly new to Stata since I need it to write my bachelor thesis. However I'm stuck... I…
Create a new variable based on a date string variable yyyy-mm-dd and a numeric variable (yyyymmdd)Hi! I am very new to STATA. I have seen you answer different questions regarding date-variables. Ho…
Subscribe to:
Post Comments (Atom)
0 Response to Merging variables into one variable after rehaping
Post a Comment