If you've asked a question, let people know where else you asked the question and what your solution(s) were! When you post a question on another platform, include those links in your questions or as a reply (if it's Discord, just mention it).
#Stata create new variable how to
See the sticked "READ ME: How to best ask for help in /r/Stata" post on how to comment here if all else fails. Make sure to include the word "Stata" in your search query. The following command generates no new values of x and is incorrect: replace x 5 if price 4099 & price 4749. I want to generate a new variable x that is equal to 5 if price belongs to a list of values. replace x 5 if price 4099 replace x 5 if price 4749. Example of existing data: Resp1 Resp2 Resp3 Resp4 Resp5 A57 A510 B89. Given the following dataset and commands: sysuse auto, clear generate x. Perform a web search for your question prior to posting here. Need to create a new binary variable in Stata based on the entries that might appear in 1 of 5 'Response' variables. Stata's online community has been active for many years and many questions and solutions are documented on StataList, which are highly indexed on contemporary search engines (e.g., Google). Stata has extensive and complete documentation you can read before posting here (and you can type help followed by the command name in console to see it, e.g. In this section we will see how to compute variables with generate and replace. Computing new variables using generate and replace Let’s use the auto data for our examples. This is not a place to find Stata tutoring. In Stata you can create new variables with generate and you can modify the values of an existing variable with replace and with recode.
Do not request that the /r/Stata community do your homework for you. Is there a way to create this new variable whilst adding a space or punctuation or something between the different. Assume good faith questions and comments.