Hello all,
This question is a bit convoluted, so please bear with me.
I am working with Supreme Court data--the problem is that I have justice-level data and I need it to be case-level data.
I have a dataset organized by individual justice behavior. The data of interest is whether a justice wrote an opinion in a given case, which I have coded as 1 if so, and 0 if not. The goal is to take that individual-level data and condense it into case level data--so the variable would read not 0 or 1 for a particular justice, but the total number of justices who wrote an opinion per case (not 0 or 1 per justice, but anywhere from 1 to 9 per case).
Here's what I have done so far: I have a variable called "opinion_two" coded 0 or 1 for whether the justice wrote an opinion. By using a certain command, I can sum the total of opinion_two for a given case citation. That is, the following command:
by lexisCite, sort : count if opinion_two==1
gives the count of opinion_two organized per case citation. It gives me a printout of the raw data I need: the sum, per case, of opinion_two: the number of justices per case who wrote an opinion. This produces an enormous printout of the data I need, which looks like this (the following is a small copy-paste of the relevant data):
-> lexisCite = 2014 U.S. LEXIS 2932
5
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> lexisCite = 2014 U.S. LEXIS 3107
1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> lexisCite = 2014 U.S. LEXIS 3108
2
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> lexisCite = 2014 U.S. LEXIS 3111
2
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> lexisCite = 2014 U.S. LEXIS 3992
3
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> lexisCite = 2014 U.S. LEXIS 4166
1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> lexisCite = 2014 U.S. LEXIS 4167
2
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> lexisCite = 2014 U.S. LEXIS 4170
2
The LEXIS stuff refers to the citation of each Supreme Court case for which I want these data. The number is the sum of opinion_two per case. I want these data but in a different format: something like in an excel format (doesn't have to be excel but it has to have separate vectors for the lexis citation and the sum of opinion_two so I can easily enter the data into a different, case-centered dataset).
So, to sum up: the command above gives me a printout of the data for the ~2500 cases for which I need to enter the number of Supreme Court justices who wrote an opinion. The command above seems to give me what I need. What I need now is a way to translate this printout of data into a format I can use to enter these data into a new dataset, one organized not by justice but by case.
I have tried to investigate existing methods for exporting tables from Stata into excel, but to no avail so far. Ideally, the finished product would be organized into separate vectors like:
lexisCite (col 1) sum of opinion_two (col 2)
2014 U.S. LEXIS 2932 5
2014 U.S. LEXIS 3107 1
..... ....
At that point, I can very easily use the "replace" command to enter the data into my other dataset. Getting the data from the printout above into the format I describe here is the task.
I hope that this convoluted task makes sense to someone. Any ideas?
Thanks, all. Happy Sunday!
Gordon
Related Posts with a question on exporting data from stata
Random-Number Generator Version ##: set seed - different resultsI found an issue with using the RNG and set seed with different versions of Stata. I had used versio…
Estimating Demand Elasticity with Log-Log Model | How to Specify Panel Regression?Hello, My objective is to estimate the effect that a 1% change in the volume of ride-share trips co…
Gsem -problems with SEM builder toolHello everyone, I am running a gsem model using the SEM builder and I keep getting this error: pare…
Anyway to conduct dynamic model on panel data by using xtabond command in stata?Dear all: I found a challenge when I run a dynamic model on long panel data. I am hopeful that you …
Update to -kmatch- available from SSCAn update to kmatch is available from the SSC archive. Type Code: . ssc install kmatch, replace t…
Subscribe to:
Post Comments (Atom)
0 Response to a question on exporting data from stata
Post a Comment