austinbean / bpci

0 stars 0 forks source link

Update BPCI_analysis_120920_od.do #1

Closed odirienz closed 3 years ago

odirienz commented 3 years ago

@austinbean This error didn't occur for me when I re-ran the do-file on the raw data (maybe I have a diff version of Stata?). Here's a bit of a work-around anyway, this should work! (I also edited the following commands that would have presented the same error).

austinbean commented 3 years ago

@odirienz None of the errors should occur for you, luckily!

The issue is not w/ Stata, but the fact that the data I have is in a slightly different format from the data you have. In particular, a bunch of variables which you have as numeric, e.g., 0/1 are actually strings in my version, or some string variables which you have as "X" or "A" are in my data 0/1, or some years 0/1 and some years "X" and "A".

I should have been clear that that was the issue. It's basically all in data formatting so far. The first problem is to rewrite the file you gave me so that in any given year in any variable you are interested in the program handles that variable as either a string OR as numeric.

You can potentially use:

capture - to run a command which might error, and catch the error and act on it rather than stopping the entire program.

ds, has(type string) - that's not the exact command but you can list variables by type.