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; ...
Then within PROC TRANSPOSE, change the BY statement:
by rec;
Do not change the ID statement.
2025 SAS Hackathon: There is still time!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!