Hello,
I am working with a dataset from a Twitter content analysis project and am stuck trying out figure out how to take 8 categorical tweet characteristic variables (resource, news, personal experience, personal opinion, marketing, spam, question, jokes/parody) and create one "tweet characteristic" variable (code below).
The problem I am having is that the categories are not mutually exclusive. The n for JokesParody is 22, but when I run this code it reduces it to 5 since a tweet can have several of these characteristics. Any help you can provide would be very much appreciated.
gen Characteristics=.
replace Characteristics = 0 if JokesParody==1
replace Characteristics = 1 if Resource==1
replace Characteristics = 2 if News==1
replace Characteristics = 3 if PersonalExperience==1
replace Characteristics = 4 if PersonalOpinion==1
replace Characteristics = 5 if Marketing==1
replace Characteristics = 6 if Spam==1
replace Characteristics = 7 if Question==1
label var Characteristics "Tweet Characteristics"
label define Characteristics 0 "Jokes/Parody" 1 "Resource" 2 "News" 3 "Personal Experience" 4 "Personal Opinion" 5 "Marketing" 6 "Spam" 7 "Question"
label val Characteristics Characteristics
Related Posts with Replace command with non-mutually exclusive categorical data
Dealing with zerosI have lots of zeros in both my dependent and independent variables. One way that I was dealing wit…
reshaping to long with a string IDI want to reshape my data from wide to long. I implement: Code: reshape long MortgageloansthUSD2010…
Appropriate regression modelMy dataset consists of an amount of lubricant added to a process at various times. The lubricant is …
Create laggingsHello, I have a dataset of 1,791 firm-year observations. Now, I would like - for each firm-year obs…
How to export list/table to excel with blank row as group separatorHello, Hoping someone has a hack to insert a blank row as a group separator when I export a list to …
Subscribe to:
Post Comments (Atom)
0 Response to Replace command with non-mutually exclusive categorical data
Post a Comment