Announcement

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

  • Collapse

    Hi all,

    I have a question related to the collapse function. I currently have 20 principal components which is daily data. I need to change this data to monthly data, and I am using the following code:

    Code:
    gen mdate = mofd(Date)
    format mdate %tm
    collapse (mean) pc1 pc2 pc3 pc4 pc5 pc6 pc7 pc8 pc9 pc10 pc11 pc12 pc13 pc14 pc15 pc16 pc17 pc18 pc19 pc20, by(mdate)

    However, my issue is that I have to make a correlation analysis with other variables in my original dataset. When I use the collapse function, this original data is deleted.
    Therefore, I need to make part of my dataset from daily to monthly data, while keeping my original dataset as well.

    How can I solve this issue?

    Thank you in advance!




  • #2
    Welcome to Statalist.

    Do you mean that you wish to keep the data as day-level, but have the month-level included, each duplicated 28-31 times? I have a hard time understanding how you envision the end product.

    Comment

    Working...
    X