I am having the following issue :
I have a table which looks like this :
WEIGHT DATE 8/1/11 1/1/11 5/1/11 ... 10/25/11
NAME CLASS
NICK 1 A . A .
JOHN 1 c+ C- . B-
JOHN 2 A . . .
MIKE 2 B B B+ A
BOB 3 D C C .
...
The dates are random dates, and they are not ordered .
I would like to order my dates (my columns) in sas. I looked up some things on google but there is nothing for this particular problem, since I have 300 dates, and therefore 300 columns names.
For you information :
My data originally looked like this :
calendar1 :
NAME CLASS CALENDaRDATE GPA
JOHN 1 1/1/11 C-
JOHN 1 8/1/11 C+
...
And I used this proc to create my table :
proc sort data=calendar1;
by NAME ClASS CALENDARDATE;
run;
PROC TRANSPOSE DATA = calendar1 OUT = calendar2 ;
BY nAME cLASS;
VAR GPA;
ID CALeNdaRDATE;
RUN ;
Do you have an Idea on how to sort my columns by dates ?
This is a not-so-elegant solution for your reference (some are borrowed from CarolinaJay65’s input). You can reorder the column using RETAIN statement.
I don’t think you can keep column name like ‘5/1/11’ since SAS doesn’t allow “/” in column name. Also the first character can’t be numerical.