05-05-2016 10:50 AM
I am confused about how to arrange my data to run a probit model.
I have data on 484 farms over 132 months for four variables. I am aware the data needs to be in stacked form such that farms have a column, months have a column, and variables are in their respective columns, rather than a column for each month as is currently the case.
Currently, I have each variable in its own matrix/spreadsheet. Here is the Quantity Matrix:
Month_1 Month_2 .... Month_j
Farm_1 Q_1_1 Q_1_2 Q_1_j
Farm_2 Q_2_1 Q_2_2 Q_2_j
Farm_i Q_i_1 Q_i_2 Q_i_j
I have matrices of equal dimensions for prices, costs, and exit decision. Column j represents the j'th month and row i represents the i'th farm in each matrix.
If anyone can give me some guidance about how to arrange this data, I would greatly appreciate it. Thanks!!
05-05-2016 11:04 AM - edited 05-05-2016 11:22 AM
May be this is what you are looking for
input Farm $ Month_1 $ Month_2 $ Month_3 $;
Farm_1 Q_1_1 Q_1_2 Q_1_3
Farm_2 Q_2_1 Q_2_2 Q_2_3
data want(keep=farm months values);
array m(*) m:;
do i=1 to dim(m);
05-05-2016 11:17 AM
Using PROC TRANSPOSE will get you most of the way there:
input Farm $ Month_1 Month_2 Month_3;
Farm1 1 2 3
Farm2 4 5 6
Farm3 7 8 9
proc sort data=Var1;
proc transpose data=Var1 out=TransposedVar1(rename=(col1=Var1));