Dear Statalisters,
I am trying to solve the following problem: assign the observations of a variable as labels to the new variables generated after -sxpose2-.
Thanks to your contribution, I managed to import multiple Excel files from a folder and clean the data.
I've got the following structure of the data:
id name v1 v2 v3 v4
"id1" "label_id1" 234 367 111 898
"id2" "label_id2" 34 67 341 222
"id3" "label_id3" 24 37 121 254
"id4" "label_id4" 23 36 116 345
When I run the following code:
sxpose2, clear firstnames force varname
drop in 1/2
I get the result:
_varname id1 id2 id3 id4
v1 234 34 24 23
v2 367 67 37 36
v3 111 341 121 116
v4 898 222 116 345
My problem, that I cannot find a solution is: assign to variables id1, id2, id3 and id4 the labels from variable "name" from the initial dataset structure.
id1 - label_id1, label_id2 etc.
Thank you very much for your help!
Related Posts with xpose/sxpose keep a variable observations to assign as labels to new variables
Fixed Effect Regression - ModeratorHello, I have panel data for a set of companies for the years 2001-2019. I am running fixed effect …
Conversion of NumbersHi everyone, I have two data sets one having numbers in Millions and the other has numbers in the t…
Question on huge suppression effect in KHB mediationDear Stata Users, I am using the user-written command KHB to perform a mediation analysis with a mu…
How to adjust linear mixed models for a factor variableDear everyone, I am using Stata 14 on Windows 10. I am using data from a longitudinal cohort study …
Bar graph showing percentages in each categoryI have: Y X 1 1 1 0 1 1 2 1 2 0 I want to have a bar graphs that displays two bars for each value o…
Subscribe to:
Post Comments (Atom)
0 Response to xpose/sxpose keep a variable observations to assign as labels to new variables
Post a Comment