Hello
I ask prefix "value" but in result I see prefix "value1"- what is the reason?
I want to get new column name "value" and not "value1"
data wide;
input famid faminc96 faminc97 faminc98 ;
cards;
1 40000 40500 41000
2 45000 45400 45800
3 75000 76000 77000
;
run;
proc transpose data=wide out=long prefix=value;
by famid;
run;
proc transpose data=wide out=long(rename=(value1=value)) prefix=value;
The reason is that is the way Proc Transpose works. It does not know that you will only have one value as each duplicate of the BY variable(s) increments the count.
Essential Meaning of prefix
You could use the ID statement which would build-in a check for unique BY groups.
data wide;
input famid faminc96 faminc97 faminc98 ;
retain id 'Value';
cards;
1 40000 40500 41000
2 45000 45400 45800
3 75000 76000 77000
;
run;
proc transpose data=wide out=long;
by famid;
id id;
run;
proc print;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.