12-21-2016 04:10 PM
I have 150 Obs with mutiple statment from 24 months, so its a long list, and I am trying to make it Long to wide.
here I have my code, can you please have a look, so see how would I add a Do-Loop on this to make my life easier? Thank you.
array misser Statement1-Statement24;
if first.ID=1 then do over misser;
if Count=1 then do;
if CountForSTMT=2 then do;
if CountForSTMT=24 then do;
if last.ID=1 then output;
12-21-2016 04:21 PM
Is this what you're trying to do:
If so, consider using a direct PROC TRANSPOSE instead, see the examples here:
12-21-2016 05:07 PM
First clarify if you want Statement_02 as used in your assignment or Statement2 as used in your Retain and Array statements.
You don't help yourself by having two different indexing variables count and CountForStmt.
No need for any do loop since your CountForStmt is the index into the array that you need:
if CountForStmt> 1 then misser[CountForStmt]=statement;
replace all of the 2 through 24 code that you indicate.