Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elaborating on the Utilities #1

Closed
IoannisPapadakis opened this issue Jun 7, 2018 · 2 comments
Closed

Elaborating on the Utilities #1

IoannisPapadakis opened this issue Jun 7, 2018 · 2 comments
Labels

Comments

@IoannisPapadakis
Copy link

In the folder Utilities @neilalex creates several routines. It is not clear to me what is he after i.e. what was missing in the standard STATA built-in commands. Please elaborate more on what each of your Utilities does.

Also, It is not clear to me when you call these Utilities what task they perform and what is the syntax rules you follow. For instance, what naxMerge "m:1 year occ using occ1990ddAssembled" 1 0 1 "etlIpumsCzOcc" does, and how it differs from naxMerge "1:1 czone ind1990 using temp/cz_industry_exRti, keepusing(rtiShare)" 0 0 1 "czIV"?

@neilalex
Copy link
Owner

neilalex commented Jul 2, 2018

Sorry this is confusing. The two main utilities are naxMerge and naxJoinby, and their points are really just to print more information to the log file than the built-in Stata commands do; their outputs are the same.

More specifically these commands also print how many records end up not included in the joined/merged dataset--if not performing a full (outer) join/merge.

For example, at line 36 in etlIpumsCzOcc.do, we could have actually used:

merge m:1 year occ using occ1990ddAssembled, keep(master match)

Had we done so, Stata would have printed the following to the log:

Result                           # of obs.
-----------------------------------------
not matched                    24,932,304
    from master                24,932,304  (_merge==1)
    from using                          0  (_merge==2)

matched                        55,647,994  (_merge==3)
-----------------------------------------

Yet I find this deceiving--the '0' on the 'from using' line is actually not accurate; for some reason Stata prints a 0 here whenever we ask it to not keep any unmatched 'using' records (i.e. whenever we specify keep(master match) ).

Yet not wanting to keep these records doesn't mean we wouldn't have liked to know how many there were--for debugging and quality control.

Alternatively, naxMerge prints the following:

Result                           # of obs.
-----------------------------------------
not matched                    24,932,313
    from master                24,932,304  (_merge==1)
    from using                          9  (_merge==2)

matched                        55,647,994  (_merge==3)

Notice the '9' next to 'from using'--there were 9 records in occ1990ddAssembled that weren't matched and which we ended up dropping.

Syntax

As for the syntax, the first part in quotes is no different than what we would have given the built-in merge command: m:1 year occ using occ1990ddAssembled. The 1 0 1 is like writing keep(master match): the first 1 means we keep any unmatched 'master' records, the 0 means we don't keep any unmatched 'using' records, and the last 1 means we keep all matched records. Finally, the last part in quotes is just a description that is also printed to the log.

Other utilities

As for the other utilities, subfile_occ1990dd_occgroups is Dorn's occupation grouping file ([A8] from his data page) and naxSaveOutput saves whatever fitted regression parameters may be in memory to outputs.dta (discussed more here).

Does this help at all?

@neilalex neilalex mentioned this issue Jul 2, 2018
@IoannisPapadakis
Copy link
Author

Thanks Neil! Now, it is clear what your utilities do and they are definitely helpful!

@neilalex neilalex closed this as completed Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants