I'm hoping you can help me with some code to change observations to variables, I have data with a structure like so:
date Index apple msft 02-01-2022 575 656 595 03-01-2022 544 682 564 04-01-2022 598 641 579 05-01-2022 718 770 589 06-01-2022 553 528 659 07-01-2022 701 500 639 08-01-2022 560 727 603 09-01-2022 733 718 774 10-01-2022 626 663 651 11-01-2022 740 715 679 12-01-2022 614 512 533 13-01-2022 517 720 634 … … … …
and I would like to generate a dataset with the following structure:
date stock value 02-01-2022 Index 575 03-01-2022 Index 544 04-01-2022 Index 598 05-01-2022 Index 718 06-01-2022 Index 553 … … … 02-01-2022 apple 656 03-01-2022 apple 682 04-01-2022 apple 641 05-01-2022 apple 770 06-01-2022 apple 528 … … … 02-01-2022 msft 595 03-01-2022 msft 564 04-01-2022 msft 579 05-01-2022 msft 589 06-01-2022 msft 659 … … …
help me?
... View more