I am trying to create a new variable (called Payment_YearMonth) in each observation related to the value stored in YearMonth in each observation and store Amount as that variable's value.
Thanks so much, I tried sorting the data first by the BY variable but SAS is saying the ID value occurs twice in the same BY group. Do you know why that might be? Kind regards
Only you know your data. You might need to add a new variable to use for the BY grouping. In your original example it looked like you wanted one output observation per input observation. data for_transpose; row+1; set have; run; proc transpose data=for_transpose out=want; by row; ...