Announcement

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

  • Using two datasets at same time in Stata?

    Hello,

    My research center has recently gathered some data, and I have to run some basic statistics on the variables to give an initial report of what we've got. They've asked me to compare our data I to well-known, international datasets to see if our results are similar for each variable. For example, for the variable "gender" I will be doing a number of descriptive statistics and graphs (box charts, tables, etc) with our data, and also for the other international database. However, switching back and forth between datasets, and creating two graphs for both varibales is clumsy and takes a lot of time.

    Is there a way that I can tell data to take two variables from two differnt datasets and incorproate them into the same graph?

  • #2
    Rumors are that multiple datasets, are forthcoming.
    You don't need multiple datasets for the plotting stats on the same graph. Generate a flag variable (my/international), append the two datasets, and do the analysis by that variable.

    Pretend foreign is such a variable, then you can do:
    Code:
    sysuse auto, clear
    graph bar price, by(foreign) over(rep78)
    graph bar price, over(foreign) over(rep78) scale(0.5)
    twoway scatter price weight if foreign , mc(red) || scatter price weight if !foreign, mc(green)
    Best, Sergiy Radyakin

    Comment


    • #3
      Thanks Sergiy! I'll give this a try. Only problem is that the two datasets have very different structures, and eliminating/renaming variables isn't the best choice in my case. I'll try to think of a way around this.
      Last edited by ACarroll; 23 Mar 2015, 05:36.

      Comment


      • #4
        Update: I looked at the stata documentation. I noticed that it said that append does not necessarily assume that you have the same variabels. I gave it a try and it worked. Thanks again for the suggestion!

        Comment

        Working...
        X