Announcement

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

  • Generate two new variables in Stata representing the change in net-pay and the change in well-being between june and october

    Hi, I'm new to Stata how can I show the above statement in Stata?
    I would really appreciate any advice on how to solve this in Stata.

  • #2
    Please see https://www.statalist.org/forums/help and show us a data example.

    Comment


    • #3
      Welcome to Statalist. Please read the Forum FAQ for excellent advice on how to get the most out of your Statalist experience. Among the things you will learn there is that to get help with how to code a solution to a problem, you almost always need to show example data. The answer to your question depends strongly on the details of how your data are organized. So nobody can help you until they see that. The effective and helpful way to show example data is by using the -dataex- command. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

      In addition to using -dataex- to show example data, please be sure to explain which variables in your data set show net pay, well-being, and month (unless the variable names themselves make it obvious).

      Finally, your question may be ambiguous. If your data extend over more than one year, do you want a separate calculation for each year, or do you want the average June to October change across all years?

      When asking for help with code, always show example data. When showing example data, always use -dataex-.

      Added: Crossed with #2, where Nick says more or less the same thing, but, as always, more concisely.

      Comment


      • #4
        Denis:
        welcome to the list.
        Please note that your query is way too broad and, as such, at risk of being left unreplied.
        Please read the FAQ and act on them when posting. This way you will increase your chances of getting helpful replies. Thanks.

        PS: Nick and Clyde's helpful replies did not display upon the uploading of my reply. I'm noticing that I've echoed some of their wise recommendations.
        Last edited by Carlo Lazzaro; 28 Dec 2021, 12:49.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          input long pidp float(netpay_may netpay_base ghq_may ghq_base ______________) int age float female byte(region qual health job_status urban ethnic marstat life_sat) float(vaccine furloughed_may)
          76165 109.80058 111.70615 12 11 0 35 1 5 3 2 1 1 1 1 6 0 0
          280165 82.13687 68.99497 7 7 0 39 1 8 4 2 1 0 1 1 5 0 1
          599765 84.23958 85.12666 7 7 0 31 1 5 2 2 1 1 1 5 7 0 0
          732365 . . 31 22 0 33 0 2 9 5 4 1 1 5 2 0 0
          1587125 85.71429 85.71429 12 23 0 52 1 1 2 3 1 1 3 5 4 0 0
          4849085 103.49246 95.60732 15 35 0 35 0 11 1 3 1 1 1 1 2 1 0
          68002725 . . 6 11 0 64 1 7 3 4 4 1 3 4 4 0 .
          68010887 459.9665 42.71117 18 7 0 54 1 1 1 2 3 1 1 1 6 1 0
          68031967 . . 10 23 0 70 1 5 4 4 4 1 1 3 3 0 0
          68035365 . . 11 7 0 66 0 7 5 3 4 1 1 3 5 0 0
          68035367 128.13351 121.56257 30 12 0 37 0 1 1 3 1 0 1 1 7 0 0
          68041487 101.84972 105.1352 5 10 0 48 1 11 1 2 1 0 1 1 6 0 0
          68045567 77.57006 77.27437 5 7 0 56 1 1 1 2 1 0 1 1 6 0 0
          68046247 . . 6 9 0 75 0 1 3 2 4 0 1 1 6 0 0
          68046251 . . 8 8 0 73 1 1 4 2 4 0 1 1 6 0 0
          68051007 23.622564 23.622564 20 19 0 57 0 1 1 3 1 1 1 1 3 0 0
          68051011 68.99497 75.565926 21 9 0 50 1 1 2 2 1 1 1 1 6 1 0
          68058487 . . 13 10 0 78 0 1 1 3 4 0 1 1 6 1 0
          68058491 . . 23 22 0 69 1 1 4 3 4 0 1 1 6 0 0
          68060527 88.70782 95.27877 10 7 0 44 0 1 1 2 1 0 1 1 6 0 0
          68060533 . . 8 21 0 62 1 7 4 3 3 1 2 1 5 0 0
          68060537 . . 7 7 0 74 0 7 1 2 4 1 3 1 6 1 0
          68061288 12.221967 25.85669 13 11 0 32 1 1 1 3 2 1 1 2 5 0 0
          68063247 17.714285 19.285715 6 6 0 51 1 2 4 2 4 1 1 1 7 0 0
          68063927 . . 10 7 0 48 1 2 5 1 1 1 1 1 6 1 0
          68063931 39.4257 36.140224 12 8 0 50 0 2 2 3 1 1 1 1 4 0 0
          68064605 . . 7 6 0 69 0 7 2 4 4 1 1 1 7 1 0
          68064609 . . 6 7 0 66 1 7 4 3 4 1 1 1 1 1 0
          68068007 68.99497 68.99497 6 6 0 51 0 2 4 3 4 1 1 1 6 0 0
          68068011 60.78128 60.78128 7 9 0 51 1 2 4 3 1 1 1 1 6 0 0
          68068015 56.31304 52.5676 10 6 0 26 1 2 3 2 4 1 1 2 6 0 0
          68097245 . . 20 10 0 68 1 7 4 2 4 1 1 4 7 0 0
          68097927 . . 13 11 0 68 1 2 3 5 2 1 1 4 5 1 0
          68112211 19.71285 32.854748 26 25 0 32 1 2 3 3 1 1 1 1 3 0 1
          68120367 . . 6 8 0 67 1 2 5 4 4 0 1 4 7 0 0
          68120375 62.5883 60.78128 8 9 0 38 1 2 3 1 1 1 1 5 6 0 0
          68125127 42.71117 42.71117 7 7 0 52 1 2 3 3 1 1 1 4 6 0 0
          68125131 55.52452 49.57782 10 9 0 27 0 2 1 2 1 1 1 5 6 0 0
          68125135 59.13855 52.5676 11 9 0 22 1 2 1 2 1 1 1 5 7 0 0
          68133285 . . 9 11 0 69 1 8 3 3 4 1 1 4 6 0 0
          68133289 . . 27 24 0 33 1 7 1 3 2 1 1 1 6 0 0
          68136009 34.85889 34.497486 6 6 0 66 1 7 4 2 2 0 1 3 6 0 0
          68137365 . . 11 9 0 64 1 8 9 2 4 1 1 3 5 0 0
          68138045 . . 9 6 0 69 0 8 2 4 4 0 1 1 6 0 0
          68138049 . . 8 7 0 68 1 8 5 2 4 0 1 1 6 0 0
          68138051 . . 7 10 0 64 1 2 4 4 4 1 1 2 5 0 0
          68144847 90.48198 95.27877 7 8 0 50 0 2 3 3 3 1 1 1 6 0 0
          68144851 166.14647 162.17104 10 12 0 42 1 2 1 2 1 1 1 1 5 0 0
          68148247 . . 6 6 0 70 0 2 3 3 4 1 1 1 6 1 0
          68148251 . . 11 9 0 71 1 2 5 3 4 1 1 1 6 0 0
          68150967 45.71429 39.4257 7 11 0 56 0 2 4 2 3 1 1 1 6 0 0
          68150971 52.5676 52.5676 12 15 0 59 1 2 4 3 1 1 1 1 6 0 0
          68150975 59.13855 57.49581 25 5 0 30 0 2 4 2 1 1 1 5 6 0 0
          68155047 . . 1 12 0 61 1 2 4 3 4 1 1 1 6 1 .
          68155051 88.70782 85.42235 8 6 0 66 0 2 5 2 1 1 1 1 6 0 0
          68155055 45.99665 39.4257 12 8 0 29 1 2 1 2 3 1 1 5 5 0 0
          68155731 116.3058 110.39196 9 10 0 49 1 2 1 3 1 1 1 1 5 0 0
          68157767 68.99497 91.46762 15 17 0 53 1 2 3 3 2 1 1 5 6 0 0
          68159131 61.5698 59.13855 14 19 0 38 1 2 1 3 1 1 1 1 2 1 0
          68160485 17.79603 . 31 18 0 67 1 8 4 3 3 1 1 4 4 1 0
          68160489 105.1352 158.79535 7 12 0 42 0 8 1 2 1 1 1 5 5 0 0
          68173407 . . 13 10 0 61 1 2 5 3 4 1 1 1 2 0 0
          68180887 12.857142 10.857142 26 19 0 48 1 2 1 4 2 1 1 1 4 0 0
          68180891 122.02254 124.84805 13 9 0 46 0 2 1 2 1 1 1 1 6 0 0
          68184971 26.678057 26.2838 11 11 0 43 1 2 1 1 4 1 1 1 2 1 0
          68185647 . . 9 7 0 56 1 2 1 2 1 1 1 4 4 1 0
          68187687 . . 6 6 0 63 0 2 1 2 4 1 1 1 6 0 0
          68187691 . 1.8070112 21 12 0 59 1 2 1 3 4 1 1 1 5 0 0
          68191771 64.36246 120.46543 21 8 0 46 1 2 2 2 1 1 1 4 4 0 0
          68193127 . . 5 3 0 65 1 2 3 2 4 1 1 4 6 0 0
          68195167 . . 11 11 0 75 0 2 4 3 4 1 1 1 6 1 0
          68195171 . . 10 8 0 75 1 2 5 3 4 1 1 1 6 1 0
          68195851 65.54523 60.78128 8 14 0 44 1 2 3 4 1 1 1 1 5 0 0
          68197211 44.35391 45.99665 14 10 0 45 1 2 2 2 2 1 1 2 6 0 0
          68197887 63.50823 63.50823 12 9 0 57 1 2 4 3 2 1 1 4 5 0 0
          68197903 32.854748 . 5 13 0 20 0 2 9 2 4 1 1 5 4 0 0
          68199247 98.56425 131.41899 5 10 0 34 0 8 3 2 1 1 1 2 6 0 0
          68202647 82.13687 75.565926 8 7 0 43 1 2 1 2 1 1 1 2 5 0 0
          68207407 . . 9 10 0 74 1 2 4 2 4 1 1 1 4 1 0
          68207411 . . 9 8 0 79 0 2 4 3 4 1 1 1 6 1 0
          68211487 . . 7 7 0 66 0 2 1 3 4 1 1 5 6 0 0
          68213527 . . 22 4 0 40 1 2 1 2 1 1 1 1 6 0 .
          68214207 52.5676 55.85307 16 11 0 59 0 2 9 3 3 1 1 4 6 1 0
          68214887 180.70113 180.70113 16 9 0 47 0 2 1 1 1 1 1 1 6 0 0
          68214891 180.70113 147.84637 8 15 0 45 1 2 1 2 1 1 2 1 6 0 0
          68216247 94.49026 93.40605 23 19 0 44 1 2 1 3 2 1 1 2 3 0 0
          68216251 78.85139 88.70782 21 13 0 43 0 2 1 2 1 1 1 2 6 0 0
          68219647 91.9933 88.70782 6 13 0 48 1 2 1 2 1 1 2 2 6 0 0
          68231223 . . 12 16 0 19 1 3 2 4 4 1 1 5 3 0 0
          68238011 46.09521 42.64547 12 11 0 60 1 3 1 4 3 1 1 1 5 1 0
          68262487 42.85714 39.4257 7 6 0 48 0 3 5 3 2 0 1 2 4 0 0
          68266567 . . 21 15 0 81 1 3 2 3 4 0 1 3 5 1 0
          68278127 . . 13 9 0 71 1 3 4 3 4 1 1 4 6 1 0
          68288327 72.28045 65.709496 8 9 0 45 1 3 1 3 1 1 1 1 5 1 0
          68288331 77.63577 77.53721 5 5 0 45 0 3 1 3 1 1 1 1 6 0 0
          68291731 . 18.760061 18 18 0 63 1 3 3 2 4 1 1 3 1 0 0
          68293087 . . 8 8 0 50 1 3 9 2 4 1 1 1 6 0 0
          68293095 . 45.99665 9 6 0 30 0 3 3 4 1 1 1 1 6 0 0
          68293099 52.5676 52.5676 8 5 0 27 0 3 1 2 2 1 1 5 6 0 0
          68293103 47.44226 49.28212 10 4 0 16 1 3 4 2 2 1 3 5 6 1 0
          end
          label values age j_dvage
          label values region j_gor_dv
          label def j_gor_dv 1 "North East", modify
          label def j_gor_dv 2 "North West", modify
          label def j_gor_dv 3 "Yorkshire and the Humber", modify
          label def j_gor_dv 5 "West Midlands", modify
          label def j_gor_dv 7 "London", modify
          label def j_gor_dv 8 "South East", modify
          label def j_gor_dv 11 "Scotland", modify
          label values qual j_hiqual_dv
          label def j_hiqual_dv 1 "Degree", modify
          label def j_hiqual_dv 2 "Other higher degree", modify
          label def j_hiqual_dv 3 "A-level etc", modify
          label def j_hiqual_dv 4 "GCSE etc", modify
          label def j_hiqual_dv 5 "Other qualification", modify
          label def j_hiqual_dv 9 "No qualification", modify
          label values health j_scsf1
          label def j_scsf1 1 "Excellent", modify
          label def j_scsf1 2 "Very good", modify
          label def j_scsf1 3 "Good", modify
          label def j_scsf1 4 "Fair", modify
          label def j_scsf1 5 "Poor", modify
          label values job_status job_status
          label def job_status 1 "Managerial/Professional", modify
          label def job_status 2 "Intermediate", modify
          label def job_status 3 "Routine", modify
          label def job_status 4 "No job", modify
          label values urban j_urban_dv
          label def j_urban_dv 1 "urban area", modify
          label values ethnic ethnic
          label def ethnic 1 "White", modify
          label def ethnic 2 "Mixed", modify
          label def ethnic 3 "Asian", modify
          label values marstat marstat
          label def marstat 1 "Married", modify
          label def marstat 2 "Living as couple", modify
          label def marstat 3 "Widowed", modify
          label def marstat 4 "Divorced/Separated", modify
          label def marstat 5 "Never married", modify
          label values life_sat j_sclfsato
          label def j_sclfsato 1 "Completely dissatisfied", modify
          label def j_sclfsato 2 "Mostly dissatisfied", modify
          label def j_sclfsato 3 "Somewhat dissatisfied", modify
          label def j_sclfsato 4 "Neither Sat nor Dissat", modify
          label def j_sclfsato 5 "Somewhat satisfied", modify
          label def j_sclfsato 6 "Mostly satisfied", modify
          label def j_sclfsato 7 "Completely satisfied", modify

          Comment


          • #6
            Sorry, the questions tell me to Generate two new variables in Stata representing the change in net-pay and the change in well-being between May and Jan/Feb 2020, and then to Provide a table of summary statistics of my choice for these two variables.

            Comment


            • #7
              Thanks for the data example. But your question refers to June and October, and for netpay I only see May and "base." As for well-being, I'll speculate that that refers to the ghq* variables, but these, too, are only given for May and "base." So, what gives?

              Added: Crossed with #6. OK. May is May. Does "base" mean Jan/Feb 2020? And is "well-being" represented by the ghq variables?

              Finally,
              Sorry, the questions tell me to...
              If this is a homework assignment or a take-home examination,* it is policy in this forum not to provide assistance in those contexts. Please explain who is posing these questions and for what purpose.

              *If the take-home examination came with explicit instructions that seeking outside assistance is acceptable, that would be a different matter.
              Last edited by Clyde Schechter; 28 Dec 2021, 13:07.

              Comment


              • #8
                the base refers to jan/feb period

                Comment


                • #9
                  the june and october is my mistake

                  Comment


                  • #10
                    "well-being" represented by the ghq variables" that correct and in regards to who is posing these questions, they were given as a means to improve our knowledge on how to use Stata, I'm doing an online course

                    Comment


                    • #11
                      Code:
                      gen delta_net_pay = netpay_may - netpay_base
                      gen delta_well_being = ghq_may - ghq_base
                      This is very basic Stata code syntax. I suggest that you follow William Lisowski's advice, which I quote from one of his posts:
                      When I began using Stata in a serious way, I started - as others here did - by reading my way through the Getting Started with Stata manual relevant to my setup. Chapter 18 then gives suggested further reading, much of which is in the Stata User's Guide, and I worked my way through much of that reading as well. All of these manuals are included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through Stata's Help menu.

                      The objective in doing this was not so much to master Stata as to be sure I'd become familiar with a wide variety of important basic techniques, so that when the time came that I needed them, I might recall their existence, if not the full syntax, and know how to find out more about them in the help files and manual.

                      Stata supplies exceptionally good documentation that amply repays the time spent studying it - there's just a lot of it. The path I followed surfaces the things you need to know to get started in a hurry and to work effectively.

                      Stata also supples YouTube videos, if that's your thing.
                      While introductory level questions are welcome in this forum, it will probably be more efficient and effective for you to go through those manual sections first so that you are exposed to the generic Stata command syntax and also the most basic "bread and butter" Stata commands. You won't remember everything, but you will retain enough that for basic work you will know what to do, perhaps referring to the help files for some details. And, of course, you can always ask questions here.

                      Comment


                      • #12
                        Thank you for the support and advice I really appreciate it

                        Comment

                        Working...
                        X