Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Different time series within the same variable.

    I have been having an issue graphing one of my variables in a time series database. My data set contains a variable called "Stock" which contains the names of different stocks for a period of time ranging from 2010-2018. I am able to graph each specific stock by using an "if" restriction, but I would like to have several series or stocks within the same graph. As the stocks alphabetical variables, Stata treats them as string and I cant just simply graph all of them.

    How could I de-string stock names or merge different series into a single graph.

    Thanks, and I look forward for any help I can get.

  • #2
    Welcome to Statalist.

    It's difficult to describe the solution to your problem in language. It's easier to answer by providing Stata code. For the code to be relevant to your problem, the author would need a better idea of your data.

    Please take a few moments to review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using code delimiters [CODE] and [/CODE], and to use the dataex command to provide sample data, as described in section 12 of the FAQ.

    The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

    After you review the FAQ, let's pretend your stock data is yearly, and the variables stock and year give the name and date, and the variable return is what you are plotting. Then something like
    Code:
    dataex stock year return if inlist(stock,"Amazon","Google")
    would display the data for two stocks in a way that could be copied and pasted into a post.

    Comment

    Working...
    X