Hi all! I am a freshman for the State software and now have a question to ask you.
I want to calculate the sum of WithdrawJan WithdrawFeb WithdrawMar WithdrawApr WithdrawMay WithdrawJun WithdrawJUL by the year 2005, 2006, 2007 and 2008. I want my final outcome is a single value and in a single column. Such as:
WUDSpriID eFactspriID Year Month Withdraw
ID1 ID1 2005 Jan XXX
ID1 ID1 2005 Feb XXX
ID1 ID1 2005 Mar XXX
ID1 ID1 2005 Apr XXX
ID1 ID1 2005 May XXX
ID1 ID1 2005 Jun XXX
ID1 ID1 2005 Jul XXX
ID1 ID1 2006 Jan XXX
ID1 ID1 2006 Feb XXX
ID1 ID1 2006 Mar XXX
ID1 ID1 2006 Apr XXX
ID1 ID1 2006 May XXX
ID1 ID1 2006 Jun XXX
ID1 ID1 2006 Jul XXX
ID1 ID1 2007 Jan XXX
ID1 ID1 2007 Feb XXX
ID1 ID1 2007 Mar XXX
ID1 ID1 2007 Apr XXX
ID1 ID1 2007 May XXX
ID1 ID1 2007 Jun XXX
ID1 ID1 2007 Jul XXX
My first step is to generate Withdraw_Jan = sum(WithdrawJan) if Year = 2005 and apply the command to 2006 2007 2008. But the stata is always shows a invalid syntax error. Could you please help me to fix that error? And if it is allowed, Could you please give me a suggestion how to transform the dataset below to the dataset format I want above?
Thank you very much!
Here is my data set:
Comment