My task is to produce many reports of each month using an historic dataset(the dataset of each month are appended in this biggest dataset). I also have to rename each of these reports in this way : report_march.dta , report_april,dta... etc
In the biggest data set I have the date variable in string format, for example "31/03/2016":
Big dataset :
clear all
input str10 date str10 value
"29/02/2016" "312"
"30/04/2016" "312"
"30/06/2016" "44"
"30/11/2015" "67"
"31/01/2016" "7"
"31/03/2016" "5"
"31/05/2016" "21"
"31/07/2016" "3"
"31/08/2016" "4"
"31/10/2015" "5"
"31/07/2016" "11"
"31/08/2016" "87"
"30/06/2016" "89"
"30/11/2015" "14"
"31/01/2016" "15"
"31/03/2016" "3"
"31/05/2016" "17"
"31/07/2016" "18"
"31/08/2016" "56"
"31/10/2015" "7"
"31/12/2015" "3"
"31/12/2015" "2345"
"29/02/2016" "23"
"30/04/2016" "8"
"30/06/2016" "89"
"30/11/2015" "5"
"31/01/2016" "27"
"31/07/2016" "12"
"31/08/2016" "29"
"30/04/2016" "34"
"30/06/2016" "4"
end
keep if date=="31/03/2016"
save report_march.dta,replace
I want a loop that take in account the month as date ("31/03/2016" , "30/04/2016", etc) and the name of the month("march", "april",etc)
Thank you for your help.
In the biggest data set I have the date variable in string format, for example "31/03/2016":
Big dataset :
clear all
input str10 date str10 value
"29/02/2016" "312"
"30/04/2016" "312"
"30/06/2016" "44"
"30/11/2015" "67"
"31/01/2016" "7"
"31/03/2016" "5"
"31/05/2016" "21"
"31/07/2016" "3"
"31/08/2016" "4"
"31/10/2015" "5"
"31/07/2016" "11"
"31/08/2016" "87"
"30/06/2016" "89"
"30/11/2015" "14"
"31/01/2016" "15"
"31/03/2016" "3"
"31/05/2016" "17"
"31/07/2016" "18"
"31/08/2016" "56"
"31/10/2015" "7"
"31/12/2015" "3"
"31/12/2015" "2345"
"29/02/2016" "23"
"30/04/2016" "8"
"30/06/2016" "89"
"30/11/2015" "5"
"31/01/2016" "27"
"31/07/2016" "12"
"31/08/2016" "29"
"30/04/2016" "34"
"30/06/2016" "4"
end
keep if date=="31/03/2016"
save report_march.dta,replace
I want a loop that take in account the month as date ("31/03/2016" , "30/04/2016", etc) and the name of the month("march", "april",etc)
Thank you for your help.
Comment