+ Reply to Thread
Results 1 to 10 of 10

about restructure repeated measure data into long format from wide format

  1. #1
    Registered User
    Join Date
    08-08-2015
    Location
    brisbane
    MS-Off Ver
    2007
    Posts
    17

    about restructure repeated measure data into long format from wide format

    Dear All,
    Good day. Hope you all are well. For my research purpose I am doing Linear mixed model. However, my data's are in wide format. I need to convert them into long format. My data are in the following format. The story is some tree species diameter was measure in different time period for some permanent plot. One species has one or more observation.

    Plot ID Spp Code 1977 1982 1987 1997 2014 Succesional group
    1 NKR 15.7 16.7 18 21.7 32 late
    1 NKR 26.1 27.9 28.8 30.9 41.1 late
    1 CMH 10.4 10.5 11.3 11.7 12.5 late
    1 CMH 10.5 10.8 10.9 11.4 11.8 late
    1 CNN 11.2 11.4 11.5 11.6 late
    1 CNN 11.7 12 12 late
    1 CNN 20.2 20.3 late
    1 CNN 20.5 21 21.2 21.4 late
    1 CNN 11.1 12.5 14.2 16.9 late
    1 CNN 21.3 24.2 26.1 30 34.2 late

    I am also attaching you my dataset. Plot ID means simply plot ID (I have 2 plot), Species code (Spp code), measurement of tree diameter in different time period and successional group for each species. I want year as a variable and also diameter as variable. So after restructure the data will look like this:

    Plot ID Spp Code Year DBH Succesional group
    1 NKR 1977 18.7 late
    1 NKR 1977 32.7 pioneer
    1 CMH 1987 21.3 mature
    2 CMH 2014 10.6 late
    2 CNN 1982 18 early
    2 CNN 1997 33.1 mature


    Can you please help me how to do this. I will be really greatful to you if you can suggest me something. Thanks and will be waiting for your kind response.

    Note to the excel file: The valued from J:N is just an example what should It look like after restructure data from A:H

    Kind Regards
    Sohel
    Attached Files Attached Files
    Last edited by sohel_for; 11-17-2015 at 07:36 PM.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: about restructure repeated measure data into long format from wide format

    Sorry Sohel,

    Can't work out what you want!

    Is there any relationship between the table in A:H and J:N? The values in the table on the right are nothing like those on the left, so it's difficult to understand.

    Regards,

    David

  3. #3
    Registered User
    Join Date
    08-08-2015
    Location
    brisbane
    MS-Off Ver
    2007
    Posts
    17

    Re: about restructure repeated measure data into long format from wide format

    Hello David,
    Thanks for your reply. The valued from J:N is just an example what should It look like after restructure data from A:H

    Regards
    Sohel

  4. #4
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: about restructure repeated measure data into long format from wide format

    Still not enough information!

    Take row 2 for example. I assume this is the measurements for one tree. However, if you run the table DOWN the page, you will have 5 different values for 5 different years.all marked 1/NKR. The next row will produce another 5 rows for 5 years!

    I don't see how you will be able to differentiate or evaluate this data.

    Would you please post a new workbook with some clearer direction of what you want, using the data in cols A:H

    DAC

  5. #5
    Registered User
    Join Date
    08-08-2015
    Location
    brisbane
    MS-Off Ver
    2007
    Posts
    17

    Re: about restructure repeated measure data into long format from wide format

    Hello David,
    I have uploaded the corrected version. The story of the data is: these are 2 long-term plots and tree's species diameter was measured in different time. Some species have one observation and some have many. In the present data format it is not possible to do Linear mixed model in SPSS. They need long format data. Therefore, each trees will have a unique ID and have 5 diameter measurement for 5 years. My English is not good. So I am sharing you a youtube video for better understanding what this long data restructure means. https://www.youtube.com/watch?v=-GNRFeHAVy0. In SPSS I am facing problem about restructuring my data. Thats why I post this in excel forum.

    Thanks
    Sohel

  6. #6
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: about restructure repeated measure data into long format from wide format

    Can't see the corrected version.

    DAC

  7. #7
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: about restructure repeated measure data into long format from wide format

    Hi again,

    I have had a guess at what you want, but for the data to make sense, I added the row number to the Plot ID.

    This is achieved by running a macro!

    Here is the file.

    sohel_for - long format.xlsm

    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  8. #8
    Registered User
    Join Date
    08-08-2015
    Location
    brisbane
    MS-Off Ver
    2007
    Posts
    17

    Re: about restructure repeated measure data into long format from wide format

    Hi David, this is excellent...Thanks a lot. Can you please tel how you do this?
    Regards

    Sohel

  9. #9
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: about restructure repeated measure data into long format from wide format

    Quote Originally Posted by sohel_for View Post
    Hi David, this is excellent...Thanks a lot. Can you please tel how you do this?
    Regards

    Sohel
    Thanks!

    It is done with a simple macro (executed by the button inserted on the screen).

    It just loops through the table, one row at a time.

    If there is a measurement in a cell, it copies the details into the new table.

    This is the macro:

    Please Login or Register  to view this content.
    Regards David

  10. #10
    Registered User
    Join Date
    08-08-2015
    Location
    brisbane
    MS-Off Ver
    2007
    Posts
    17

    Re: about restructure repeated measure data into long format from wide format

    Thanks again.

    Kind Regards
    Sohel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Convert data from wide to long format
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2015, 06:52 PM
  2. Rearranging data to wide format
    By erikabee in forum Excel General
    Replies: 5
    Last Post: 10-21-2014, 07:47 PM
  3. Need help converting long data into wide form.
    By gbear in forum Excel General
    Replies: 4
    Last Post: 08-12-2013, 02:21 AM
  4. transforming a long dataset into a wide format
    By dmunte in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2013, 11:42 AM
  5. long to wide transformation of panel data with many variables
    By mradzik79 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-05-2012, 02:44 PM
  6. [SOLVED] Repeated data into flat file format
    By Paul Simon in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-10-2006, 03:29 AM
  7. restructure long to wide
    By alphapoint05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2005, 09:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1