Hi,
I have thousands of stata datasets and I want to create some harmony between them.
The first step for me is : if the name of the first variable is "v1", I want to change the name of all of the variables equal to their first observation. Like below:
------------------ copy up to and including the previous line ------------------
It is probably easier than what I think but how can I do that?
I have thousands of stata datasets and I want to create some harmony between them.
The first step for me is : if the name of the first variable is "v1", I want to change the name of all of the variables equal to their first observation. Like below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str32(v1 v2) str19 v3 str43 v4 str22 v5 str5 v6 str16 v7 `""Personal identity number""' "Name" "0711 Theory 10.0 hp" "0712 Laboratory Work and Assignments 5.0 hp" "% for the whole course" "Grade" "Examination date" "1" "A" "VG" "G" "93" "VG" "2023-03-21" "2" "S" "VG" "G" "80" "VG" "2023-03-21" "3" "D" "G" "G" "75,5" "G" "2023-03-21" "4" "R" "VG" "G" "90,5" "VG" "2023-03-21" "5" "B" "VG" "G" "80" "VG" "2023-03-21" "6" "Y" "VG" "G" "82,5" "VG" "2023-03-21" "7" "J" "VG" "G" "84,8" "VG" "2023-03-21" "8" "N" "VG" "G" "97,8" "VG" "2023-03-21" "9" "F" "VG" "G" "87,8" "VG" "2023-03-21" "10" "T" "VG" "G" "85,8" "VG" "2023-03-21" end
It is probably easier than what I think but how can I do that?
Comment