BookmarkSubscribeRSS Feed
srikanthyadav44
Quartz | Level 8

dear all

 

i have the quarterly data from march, 2007 to March, 2018 in the following format. 

 Mar-07Jun-07Sep-07Dec-07Mar-08Jun-08Sep-08Dec-08…………….Mar-17Jun-17Sep-17Dec-17Mar-18
Company InvestmentInvestmentInvestmentInvestmentInvestmentInvestmentInvestmentInvestment InvestmentInvestmentInvestmentInvestmentInvestment
3I Infotech Ltd.24.0327.2930.3431.7333.3933.232.4628.48 52.3148.9647.8947.7338.96
3M India Ltd.1.948.618.7810.1910.5810.9611.3611.46 11.7211.5711.4511.411.22
3P Land Holdings Ltd.0.330.330.330.110.110.110.110.11 0.1111.9714.7711.4511.29
63 Moons Technologies Ltd.33.0333.3934.4232.6133.834.6534.3834.03 11.5611.184.515.335.48

 

i want to transpose the data as follows 

company PeriodInvestment
3I Infotech Ltd.20070324.03
3I Infotech Ltd.20070627.29
3I Infotech Ltd.20070930.34
3I Infotech Ltd.20071231.73
3I Infotech Ltd.20080333.39
3I Infotech Ltd.20080633.2
3I Infotech Ltd.20080932.46
3I Infotech Ltd.20081228.48
3I Infotech Ltd.……………………………..
3I Infotech Ltd.……………..……………
3I Infotech Ltd.…………..………………
3I Infotech Ltd.20170352.31
3I Infotech Ltd.20170648.96
3I Infotech Ltd.20170947.89
3I Infotech Ltd.20171247.73
3I Infotech Ltd.20180338.96
3M India Ltd.2007031.94
3M India Ltd.2007068.61
3M India Ltd.2007098.78
3M India Ltd.20071210.19
3M India Ltd.20080310.58
3M India Ltd.20080610.96
3M India Ltd.20080911.36
3M India Ltd.20081211.46
3M India Ltd.………………
3M India Ltd.…………….. 
3M India Ltd.………….. 
3M India Ltd.20170311.72
3M India Ltd.20170611.57
3M India Ltd.20170911.45
3M India Ltd.20171211.4
3M India Ltd.20180311.22

 

please suggest a SAS code to transpose the data in the above format

 

thanks in advance 

 

 

 

 

2 REPLIES 2
andreas_lds
Jade | Level 19

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!

Reeza
Super User

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 

 

 

 

 


 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 353 views
  • 0 likes
  • 3 in conversation