@Jens89 wrote:
When I'm transposing, I want my column names to be a merged version of 2 separate columns.
Column 1: is called "Topic", example: Cars per household
Column 2: is called "Variable", example: 3
When I transpose I want to merge these two columns and as a result have something like "Cars per household : 3"
Both column names are of the type character.
I've tried something like
transpose data = mydataset out = transposed_data;
id Topic:Variable;
run;
but that doesn't run which I expected.
did you try
ID topic variable;
Note: this will not be valid if Topic values are numeric or text starting with a digit as SAS variable names don't allow digits in the first position. Reverse the order of the variables if this is the case.
Also if the combinations of the ID variables could result in the same value such as
Var1 Var2
AB CD
A BCD
would both attempt to create a variable "ABCD" would be invalid.
Example with a data set you should have available:
proc transpose data=sashelp.class
out=work.trans
;
id name age;
run;
Otherwise post example data and what you want for output from that example data. It isn't clear if you have an existing "variable" named variable or not.