Hello, i'm sure my problem is very basic, but I couldn't find an answer in past topics.
An example of what I want to do is
gen x=.
replace x=0 if y=("Married", "Engaged")
The thing is that variable y is a numeric variable with a certain label related to each number, but I want to work with the labels.
I can't work with the numeric values because for some observations if it says "Married" the value of y=1 and for other its y=3
Thanks!
José
Related Posts with Labels
Replace if value is a dateHi, I am trying to replace the value of one variable when the condition holds (the condition is that…
keep observations between staryear and endyear.Dear All, I have this dataset, Code: * Example generated by -dataex-. To install: ssc install datae…
calculating the number by comparing this period and previous periodDear All, Suppose that I have this data Code: * Example generated by -dataex-. To install: ssc inst…
Identifying sequences in string variables across observationsHello. I have string data in the format described below. I want to generate a new variable "Pregnanc…
vce(cluster var1 var2) varlist not allowed r(101)Hi!, I am trying to run fixed effect with two-way clustering. For instance: reghdfe capx x1 x2, abs…
Subscribe to:
Post Comments (Atom)
0 Response to Labels
Post a Comment