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

  • Variable Labels

    Hello dear forum members, I am new here and am currently learning Stata. I am a beginner and have only one question. Maybe there is already a thread to it, I apologize ifthere is a similar one. Now my problem. I have already published an Exel file with a list of buildings (number of floors, year of construction and buildings on the property).
    Click image for larger version

Name:	Bildschirmfoto 2019-06-30 um 14.55.33.png
Views:	2
Size:	309.8 KB
ID:	1505493
    The task is to delete all observations with more than 10 floors. Here is my code
    drop if STORY> 10
    :D so far so good. No science. But why are not they deleted? When I go to the "35" but I see a "5". Do you see what I mean? The AGE is also wrong from front to back. It should be deducted from the year 2019 - YRB, but with AGE I do not get the right values. Maybe the pros can help me a bit and give me a hint what I'm doing wrong. I would be very thankful. Yours sincerely
    Attached Files

  • #2
    1) You have accidentally posted your question in the section of the forum labeled as for "Mata," the matrix programming language in Stata. People not interested in Mata are unlikely to read your question here. This is something you will want to pay attention in the future.

    2) I have trouble understanding your question, but I suspect that you are confused by the difference between "value labels" and the actual values of your variables. (The blue display in the Data Editor indicates a value label, not an actual value.) And further, something is strange about your data set, because it's quite unusual to put value labels on a variable such as "YRB," whose values mean exactly what they say. Try browsing your data with the "no label" option, i.e. -browse, nolabel- and compare what you see to what you show above. This will likely reveal a substantial confusion about value vs. value labels that was involved in the preparation of the data file. Perhaps the -encode- command was erroneously used on some raw data.

    3) I suspect your drop command is doing just what you want, but you are confused because observations with the value label "35" (for example) do not have the numeric value of 35.

    4) In general, per the FAQ, posting screenshots is not a good idea for getting help with a data set. Check out the FAQ about using -dataex- to present data here, and use it if you need to follow up.