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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.