Announcement

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

  • Matlab-like structures in Stata

    Hi All,

    I was wondering if there is anything in Stata that mirrors structures in Matlab. Specifically, in my dataset I have a concept, but there are 3 or 4 different ways to calculate it. I would like to refer to each different way of calculating the concept as something like concept.type1, concept.type2, etc... as opposed to just naming variables in a neat way. I'm not sure such a thing exists in Stata, but it would be great if someone more knowledgeable could tell me.

    Thanks.

  • #2
    Could you please lay out in more detail the pseudo-code or algorithm that you're trying to implement in Stata, perhaps with reference to a data set shipped with Stata (so that all readers can experiment)? I am unfamiliar with Matlab's structures. Still, it may be the case that the same functionality can be achieved in Stata (or Mata) through a different route.

    Comment


    • #3
      I also am not familiar with Matlab, but from what you write, it seems you are looking for some kind of class programming. This is probably better done in Mata (where there are so-called structures), but Stata also has some utilities. See help class.

      Best
      Daniel

      Comment


      • #4
        See http://www.stata.com/support/faqs/da...nt-sas-arrays/ for a question that may have some similarities.

        My guess, without ever having used MATLAB at more than a Mickey Mouse level, is that the answer is

        1. Yes, there is class programming in Stata.

        2. In practice, we mostly just use a loop and related names.

        Comment


        • #5
          Thanks everybody! I will probably stick to what I've been doing (using related names), but I will read more about class programming.

          Stephen Jenkins I don't have a specific routine in mind, I was just wondering about this from an organizational perspective.

          Comment

          Working...
          X