Announcement

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

  • Variables' storage type

    Dear all,

    I am new in this community, thus I apologize in advance in case of off-topic.
    I am wondering whether there exists a function whose output is the storage type of a variable. If this is not the case, I would appreciate suggestion on how discriminate variables on this basis (storage type).

    Many thanks,

    John

  • #2
    You can use the command confirm to determine if a variable is of a certain type, i.e. string, numeric, etc. Is that what you're looking for?

    Comment


    • #3
      "John ThePriest" You are asked to use full real names here. If you don't want to, there are many forums without such a request.

      ds is a command that might help.

      Comment


      • #4
        Thanks a lot everybody. Didn't know about the name thing, I'll change it immediately. sorry about that

        Comment


        • #5
          How about:
          Code:
          sysuse auto, clear
          
          loc type : type mpg
          di "`type'"
          
          loc type : type make
          di "`type'"
          
          loc type : type foreign
          di "`type'"
          Which results in:
          Code:
          . loc type : type mpg
          
          . di "`type'"
          int
          
          . 
          . loc type : type make
          
          . di "`type'"
          str18
          
          . 
          . loc type : type foreign
          
          . di "`type'"
          byte
          Best,
          Alan

          Comment

          Working...
          X