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
Loop for moving rangeGoodafternoon, I have a file which includes a significant amount of cusips (S&P1500) and dates …
Confusing behavior by ustrregexs()I'm trying to use ustrregexs to extract substrings from a string. With the data below: Code: clear…
How to change a line pattern within a same graph? Hi, I would like to plot a graph using Code: twoway line and draw a different graph pattern after …
Creating new outcome variable - invalid syntax r(198) problemI have twelve disease variables in my dataset. I want to to create an outcome variable "multimorbidi…
combining several observationsHi I have done a quantitative content analysis on a number of articles and have coded them binary o…
Subscribe to:
Post Comments (Atom)
0 Response to Replace command with non-mutually exclusive categorical data
Post a Comment