⚲
Project
General
Profile
Sign in
Register
Home
Search
:
Understanding Society User Support
All Projects
Understanding Society User Support
Overview
Activity
Issues
Download (969 Bytes)
Support #1714
» merging COVID19 waves - long .do
amwaj abugamza
, 06/09/2022 10:05 AM
/*****************************************************************************************
* MERGING INDIVIDUAL FILES ACROSS WAVES INTO LONG FORMAT *
*****************************************************************************************/
clear
// SET WORKING DIRECTORY
cd
"/Users/amwaj-opto/Desktop/COVI19 "
//loop through each wave
foreach
w
in
ca
cb
cc
cd
ce
cf
ck
cg
ch
ci
{
// find the wave number
local
waveno
=
strpos
(
"abcdefghijklmnopqrstuvwxyz"
,
"`w'"
)
// open the individual level file
use
pidp
`w'
_age
using
"`w'_indresp_w"
,
clear
// drop the wave prefix from all variables
rename
`w'
_
*
*
// create a wave variable
gen
wave
=
`waveno'
// save one file for each wave
save
temp
`w'
,
replace
}
// open the file for the first wave (wave a_)
use
temp
ca
,
clear
// loop through the remaining waves
foreach
w
in
b
c
d
e
f
g
h
i
{
// append the files for the second wave onwards
append
using
temp
`w'
}
« Previous
1
2
3
Next »
(1-1/3)
Loading...