Announcement

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

  • Change format for variables

    Hello everyone,

    I just started using Stata, so I am working on getting to know the program and its features
    I am currently working on creating a Trade dataset with different variables. I have downloaded data on export to counterpart countries for a specific country, and will merge this with the GDP of every country. My problem is that the observations have different measures. For export the observations are expressed in millions(ex. 0.221748, which will be 220,748 written with all decimals), and contrary the GDP variables are written in all decimals(ex. 3480355189, which would be approx. 3.480 mio.)

    I have attached a picture for you to get a clear picture of my question.
    I would like to change the format of GDP so that 3480355189 would be 3.480 instead.

    Thank you in advance!
    Click image for larger version

Name:	Skærmbillede 2020-05-08 kl. 16.57.38.png
Views:	1
Size:	212.5 KB
ID:	1551988

  • #2
    Your question is nothing to do with (display) format -- in Stata's sense, for which see

    Code:
    help format
    I think you want to scale your values to billions for I which suggest

    Code:
    clonevar gdp2 = gdp 
    replace gdp2 = gdp2 / 1e9
    I didn't overwrite your original variable, just in case you change your mind.

    Comment


    • #3
      Thank you very much Nick Cox! This was just what I wanted
      Have a great day

      Comment

      Working...
      X