Hi,

Having monthly panel data, I want to convert from monthly to quarterly. Used these following options,

gen month = substr(E,1,2)
destring month, replace
destring D, replace
gen qdate = qofd(dofm(ym(D, month)))
format %tq qdate

But after that I run the Collapse option "collapse pr, by (ID qdate)" , it shows the error,


"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "01-January" "56.8" 1 1 200
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "03-March" "68.09999999999999" 1 3 200
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "02-February" "57.5" 1 2 200
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "06-June" "72.2" 1 6 201
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "05-May" "69.09999999999999" 1 5 201
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "04-April" "66.09999999999999" 1 4 201
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "07-July" "72.7" 1 7 202
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "08-August" "70" 1 8 202
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "09-September" "67.7" 1 9 202
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "12-December" "85.09999999999999" 1 12 203
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "11-November" "70" 1 11 203
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2010 "10-October" "77.3" 1 10 203
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2011 "01-January" "70.7" 1 1 204
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2011 "03-March" "79" 1 3 204
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2011 "02-February" "68.5" 1 2 204
"B-D. (Mining And Quarrying; Manufacturing; Electricity, Gas, Steam And Air Conditioning Supply)" 2011 "05-May" "79.5" 1 5 205

How can I solve this problem? Pls, help me!