BookmarkSubscribeRSS Feed
srikanthyadav44
Quartz | Level 8

Dear all,

Greetings of the day

 

I have  the quarterly data of a variable from june,2009 to march, 2018.  

with those values, i have to compute the average value of the variable for the previous three years. 

 

For example, at the end of march, 2012, i have to compute the average value of the variable from june,2009 to march,2012.

Next at the end of march, 2013, i have to compute the average value of the variable from june,2010 to march,2013. and so on  till march, 2018. 

 

the format of my dataset is as follows

Company Namevar_june2009var_sept2009var_dec2009var_march2010................var_march2018
20 Microns Ltd.2.052.050.460.29..............0.29
3I Infotech Ltd.4.417.7416.598.08...............8.22
3M India Ltd.5.925.885.425.33...............5.14

 

please help me writing the SAS code to perform the above mentioned calculation. 

 

thanks in advance. 

1 REPLY 1
Reeza
Super User
You likely want an array but the coding should be pretty straightforward with an array. Have you tried an array solution yet? It would help if you can provide some data as a data step.

https://stats.idre.ucla.edu/sas/seminars/sas-arrays/arrays-in-sas/

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
  • 1 reply
  • 292 views
  • 0 likes
  • 2 in conversation