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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: