-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a couple of unit tests relating to addobs
- Loading branch information
1 parent
c2eece7
commit a2a1259
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
set verbose off | ||
clear | ||
set assert stop | ||
|
||
# artificial "outer" panel data | ||
nulldata 6 | ||
setobs 2 1:1 --stacked-time-series | ||
genr time | ||
series country = $unit | ||
series year = time + 2001 | ||
series x = year * country | ||
delete index time | ||
store rhs.csv | ||
|
||
# artificial "inner" panel data | ||
nulldata 6 | ||
setobs 2 1:1 --stacked-time-series | ||
genr time | ||
series country = $unit | ||
series year = time + 1999 | ||
series x = year * country | ||
delete index time | ||
|
||
# extend LHS in time dimension | ||
dataset addobs 2 --panel-time | ||
# stick in the RHS data | ||
join rhs.csv x --ikey=country,year | ||
remove("rhs.csv") | ||
|
||
assert({x} == {year * country}) | ||
print -o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
set verbose off | ||
clear | ||
set assert stop | ||
set seed 12345 | ||
|
||
nulldata 6 | ||
setobs 2 1:1 --stacked-time-series | ||
genr time | ||
series country = $unit + 3 | ||
series year = time + 1999 | ||
series x = year * country | ||
delete index time | ||
store rhs.csv | ||
|
||
# artificial panel data | ||
nulldata 6 | ||
setobs 2 1:1 --stacked-time-series | ||
genr time | ||
series country = $unit | ||
series year = time + 1999 | ||
series x = year * country | ||
delete index time | ||
|
||
# extend LHS in cross-sectional dimension | ||
dataset addobs 3 | ||
# add the RHS data | ||
join rhs.csv x --ikey=country,year | ||
remove("rhs.csv") | ||
|
||
assert({x} == {year * country}) | ||
# print -o |