BookmarkSubscribeRSS Feed
srikanthyadav44
Quartz | Level 8

I have unbalanced panel data. I have to compute standard deviation for a variable for the past five years recursively.

 

For example, standard deviation of the variable X for the year 2000 is computed based the observations from 1995 to 1999; for the year 2001, from 1996 to 2000 and so on.

As I have unbalanced panel, I am getting difficulty in making computation in SAS

Anybody please help me out with this.

Thanks in advance

7 REPLIES 7
PaigeMiller
Diamond | Level 26

You haven't specified how to handle this lack of balance in the computation of the standard deviation, and so we really can't advise you until that is specified.

--
Paige Miller
srikanthyadav44
Quartz | Level 8

thanks Mr. PaigeMiller for your prompt reply.

 

if there is no any observation for any the preceding five years data of the variable, i want to take only the available number of years for computation of standard deviation. 

I think this is the only alternative which can be implemented easily. of course at the cost of accuracy. 

please help me writing the SAS code

thanks in advance 

PaigeMiller
Diamond | Level 26

@srikanthyadav44 wrote:

thanks Mr. PaigeMiller for your prompt reply.

 

if there is no any observation for any the preceding five years data of the variable, i want to take only the available number of years for computation of standard deviation. 

I think this is the only alternative which can be implemented easily. of course at the cost of accuracy. 

please help me writing the SAS code

thanks in advance 


Do we treat each available observation equally? Or do we account for the lack of balance in some way? If year 1996 has 3 data points and 1997 has 400 data points, do we treat this as 403 data points, or do we weight 1996 somehow to be equal in importance to 1997?

--
Paige Miller
srikanthyadav44
Quartz | Level 8

Dear paigemiller

can you please suggest me the SAS code, for computing standard deviation recursively  for the balanced panel data? 

thanks in advance 

 

PaigeMiller
Diamond | Level 26

I'd like to help, but you haven't answered my question.

--
Paige Miller
srikanthyadav44
Quartz | Level 8

dear Mr. PaigeMiller

greetings of the day

 

for the computation of standard deviation, I would like to give equal weightage to all the time series observations. 

please help me writing the code. 

 

thanks in advance 

Reeza
Super User

If you have the license for SAS/ETS consider using PROC EXPAND. If that doesn't work for some reason you need to post example data and explain what issues you're running into.

 

https://gist.github.com/statgeek/07a3708dee1225ceb9d4aa75daab2c52

 

https://gist.github.com/statgeek/27e23c015eae7953eff2

 


@srikanthyadav44 wrote:

I have unbalanced panel data. I have to compute standard deviation for a variable for the past five years recursively.

 

For example, standard deviation of the variable X for the year 2000 is computed based the observations from 1995 to 1999; for the year 2001, from 1996 to 2000 and so on.

As I have unbalanced panel, I am getting difficulty in making computation in SAS

Anybody please help me out with this.

Thanks in advance


 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1284 views
  • 0 likes
  • 3 in conversation