Help using Base SAS procedures

Getting _character after transposing

Reply
Occasional Contributor
Posts: 8

Getting _character after transposing

Hi,

I am using proc transpose to transpose data by month.
Month is in date9. format.
After transposing I am getting _before date.
Ex _01jun2009.
How can I remove that?

Thanks ,
Respected Advisor
Posts: 3,777

Re: Getting _character after transposing

V7 SAS Names cannot begin with digits so PROC TRANSPOSE adds the underscore.

If you use the IDLABEL statement you can create variable labels which are not bound by the rules of SAS names.

Then when you display the columns use the Labels instead of the Names.

There are other options but I would stick with V7 SAS names.
Super Contributor
Super Contributor
Posts: 365

Re: Getting _character after transposing

Hello ExcelSAS,

You could also use format month MONYY7.; in your proc TRANSPOSE, then you should get Jun2009 instead of 01Jun2009 like in following example:
[pre]
data i;
d="01Jun2009"d; v=1; output;
d="01Jul2009"d; v=2; output;
format d date9.;
run;
proc transpose data=i out=t;
var v;
id d;
format d MONYY7.;
run;
[/pre]
Sincerely,
SPR
Super User
Posts: 9,676

Re: Getting _character after transposing

Add a system option before your code.


[pre]



options validvarname=any;
[/pre]


Ksharp
Ask a Question
Discussion stats
  • 3 replies
  • 131 views
  • 0 likes
  • 4 in conversation