+ Reply to Thread
Results 1 to 2 of 2

Thread: Create a new column based on count of two other columns

  1. #1
    Points: 4,308, Level: 41
    Level completed: 79%, Points required for next Level: 42

    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Create a new column based on count of two other columns



    I am new to STATA but what I want to create a new column that takes the values of two columns for example:

    Age Frequency
    6 1
    7 2
    8 5
    9 4

    And create a third column that shows the values of age based on the frequency. They should look as follows:

    6
    7
    7
    8
    8
    8
    8
    8
    9
    9
    9
    9

    So for a frequency of 2, the third column would place two 7's in the column. I have a large dataset of over 10000 values in my column following this format. What is the easiest way I should approach this in excel

    Thanks

  2. #2
    RoboStataRaptor
    Points: 7,341, Level: 56
    Level completed: 96%, Points required for next Level: 9
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,018
    Thanks
    9
    Thanked 241 Times in 234 Posts

    Re: Create a new column based on count of two other columns


    I don't quite understand - do you want to do this in Stata or Excel?

    In Stata the number of observations (rows) is the same for each variable (column) - the dataset must be rectangular. Maybe you just want to generate a variable with the numbers to copy and paste into Excel for some reason. If that's the case then you just need to run:
    expand Frequency

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats