Hey,
I want to generate a new variable out of a variable that is already existing.
However, the existing variable contains a date and I do not know how write the if equation properly. I tried with spaces/without, with "" and without and it does not work.
That is the command:
gen war_recurrence=.
replace war_recurrence =1 if peacefail="31dec2006"
replace war_recurrence = 0 if peacefail !=31dec2006
Thankyou,
There
Related Posts with new variable: replace with nonumeric variable content
re-run the entire do file with different data (different years)Hello, I have written a do file with all the codes I need to conduct the tests I want for a year (a…
compare entire columns in a dta file and create a new column based on the resultHello all, Can some help me with this. I have few columns to compare and generate a new column base…
DID with Two Separate CohortsHi there, I am new to STATALIST so my apologies if this question has already been addressed. I am u…
LR intervalDoes anyone have code for estimating the interval Likelihood ratio? I have done some analyses using …
Convert table to matrix and export as excel fileHi everyone, I am trying to convert this table to a matrix and export it as an excel file. Sorry, I…
Subscribe to:
Post Comments (Atom)
0 Response to new variable: replace with nonumeric variable content
Post a Comment