I have some data that was misclassified for a certain date range and would like to change using Stata. I am trying to change variable "type" to "3" for date range Dec 17, 2018 to Jan 10, 2019. Below is an example of how the data looks and the code I've tried. I also have a variable for date that is a string variable.
input type date
1, 03jan2018
2, 05mar2019
2, 25dec2018
2, 01jan2019
replace type = 3 if inrange(date, 17dec2018, 10jan2019)
Related Posts with Replacing a data variable if data falls within a date range
Is it possible to add multiple recode commands to one newly generated variable?Hello all! I saw a few forums that were somewhat similar to this but did not answer this exact quest…
SubcontractingHey everyone! I am looking for an econometric model for my research. I will be using the CPS Conti…
marginsplot and legend labelsHello, I'm attempting to graph a margins plot, but my legend labels command doesn't change the label…
How to differentiate "tabulate", "table", "tabstat", "tabdisp"?I don't know which one should be used in specific cases. Many thanks in advance! …
How to extract part of string between two symbols?I have a string variable and try to keep part of this variable. This variable is a string and the va…
Subscribe to:
Post Comments (Atom)
0 Response to Replacing a data variable if data falls within a date range
Post a Comment