dear all
i have the quarterly data from march, 2007 to March, 2018 in the following format.
Mar-07 | Jun-07 | Sep-07 | Dec-07 | Mar-08 | Jun-08 | Sep-08 | Dec-08 | ……………. | Mar-17 | Jun-17 | Sep-17 | Dec-17 | Mar-18 | |
Company | Investment | Investment | Investment | Investment | Investment | Investment | Investment | Investment | Investment | Investment | Investment | Investment | Investment | |
3I Infotech Ltd. | 24.03 | 27.29 | 30.34 | 31.73 | 33.39 | 33.2 | 32.46 | 28.48 | 52.31 | 48.96 | 47.89 | 47.73 | 38.96 | |
3M India Ltd. | 1.94 | 8.61 | 8.78 | 10.19 | 10.58 | 10.96 | 11.36 | 11.46 | 11.72 | 11.57 | 11.45 | 11.4 | 11.22 | |
3P Land Holdings Ltd. | 0.33 | 0.33 | 0.33 | 0.11 | 0.11 | 0.11 | 0.11 | 0.11 | 0.11 | 11.97 | 14.77 | 11.45 | 11.29 | |
63 Moons Technologies Ltd. | 33.03 | 33.39 | 34.42 | 32.61 | 33.8 | 34.65 | 34.38 | 34.03 | 11.56 | 11.18 | 4.51 | 5.33 | 5.48 |
i want to transpose the data as follows
company | Period | Investment |
3I Infotech Ltd. | 200703 | 24.03 |
3I Infotech Ltd. | 200706 | 27.29 |
3I Infotech Ltd. | 200709 | 30.34 |
3I Infotech Ltd. | 200712 | 31.73 |
3I Infotech Ltd. | 200803 | 33.39 |
3I Infotech Ltd. | 200806 | 33.2 |
3I Infotech Ltd. | 200809 | 32.46 |
3I Infotech Ltd. | 200812 | 28.48 |
3I Infotech Ltd. | ……………… | …………….. |
3I Infotech Ltd. | …………….. | …………… |
3I Infotech Ltd. | ………….. | ……………… |
3I Infotech Ltd. | 201703 | 52.31 |
3I Infotech Ltd. | 201706 | 48.96 |
3I Infotech Ltd. | 201709 | 47.89 |
3I Infotech Ltd. | 201712 | 47.73 |
3I Infotech Ltd. | 201803 | 38.96 |
3M India Ltd. | 200703 | 1.94 |
3M India Ltd. | 200706 | 8.61 |
3M India Ltd. | 200709 | 8.78 |
3M India Ltd. | 200712 | 10.19 |
3M India Ltd. | 200803 | 10.58 |
3M India Ltd. | 200806 | 10.96 |
3M India Ltd. | 200809 | 11.36 |
3M India Ltd. | 200812 | 11.46 |
3M India Ltd. | ……………… | |
3M India Ltd. | …………….. | |
3M India Ltd. | ………….. | |
3M India Ltd. | 201703 | 11.72 |
3M India Ltd. | 201706 | 11.57 |
3M India Ltd. | 201709 | 11.45 |
3M India Ltd. | 201712 | 11.4 |
3M India Ltd. | 201803 | 11.22 |
please suggest a SAS code to transpose the data in the above format
thanks in advance
please post the data you have in usable form, that is a data step using datalines-statement. You should take care that all variables have valid sas-names, value like "Mar-07" are not valid names!
Have you tried a basic PROC TRANSPOSE? From your data, it appears fairly straightforward.
Transposing data tutorials:
Wide to Long:
https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/
https://stats.idre.ucla.edu/sas/modules/reshaping-data-wide-to-long-using-a-data-step/
@srikanthyadav44 wrote:
dear all
i have the quarterly data from march, 2007 to March, 2018 in the following format.
Mar-07 Jun-07 Sep-07 Dec-07 Mar-08 Jun-08 Sep-08 Dec-08 ……………. Mar-17 Jun-17 Sep-17 Dec-17 Mar-18 Company Investment Investment Investment Investment Investment Investment Investment Investment Investment Investment Investment Investment Investment 3I Infotech Ltd. 24.03 27.29 30.34 31.73 33.39 33.2 32.46 28.48 52.31 48.96 47.89 47.73 38.96 3M India Ltd. 1.94 8.61 8.78 10.19 10.58 10.96 11.36 11.46 11.72 11.57 11.45 11.4 11.22 3P Land Holdings Ltd. 0.33 0.33 0.33 0.11 0.11 0.11 0.11 0.11 0.11 11.97 14.77 11.45 11.29 63 Moons Technologies Ltd. 33.03 33.39 34.42 32.61 33.8 34.65 34.38 34.03 11.56 11.18 4.51 5.33 5.48
i want to transpose the data as follows
company Period Investment 3I Infotech Ltd. 200703 24.03 3I Infotech Ltd. 200706 27.29 3I Infotech Ltd. 200709 30.34 3I Infotech Ltd. 200712 31.73 3I Infotech Ltd. 200803 33.39 3I Infotech Ltd. 200806 33.2 3I Infotech Ltd. 200809 32.46 3I Infotech Ltd. 200812 28.48 3I Infotech Ltd. ……………… …………….. 3I Infotech Ltd. …………….. …………… 3I Infotech Ltd. ………….. ……………… 3I Infotech Ltd. 201703 52.31 3I Infotech Ltd. 201706 48.96 3I Infotech Ltd. 201709 47.89 3I Infotech Ltd. 201712 47.73 3I Infotech Ltd. 201803 38.96 3M India Ltd. 200703 1.94 3M India Ltd. 200706 8.61 3M India Ltd. 200709 8.78 3M India Ltd. 200712 10.19 3M India Ltd. 200803 10.58 3M India Ltd. 200806 10.96 3M India Ltd. 200809 11.36 3M India Ltd. 200812 11.46 3M India Ltd. ……………… 3M India Ltd. …………….. 3M India Ltd. ………….. 3M India Ltd. 201703 11.72 3M India Ltd. 201706 11.57 3M India Ltd. 201709 11.45 3M India Ltd. 201712 11.4 3M India Ltd. 201803 11.22
please suggest a SAS code to transpose the data in the above format
thanks in advance
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.