DATA Step, Macro, Functions and more

transpose and ascending display of date

Super Contributor
Posts: 698

transpose and ascending display of date

I use the following code:
proc transpose data=adhoc2 out=Out1;
by boutique_src_cd ph_name BN_NAME ;
id date;
var total;

in the output the date is displayed in alphabetical order of the month i.e Apr_09,
Apr_10 ,Aug_09,Dec_09.
How to display the dates in asceding order instead?Mar_09 to Aug_10?
Super Contributor
Super Contributor
Posts: 3,176

Re: transpose and ascending display of date

You will need to pre-sort your data using a SAS numeric-type DATE variable, even if you choose to transpose a character-formatted variable "date". As SAS encounters the input data, that event cause the transposed ID variables to get added to the PDV, so by pre-sorting your file, that takes care of column order in the output file.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

proc transpose id varibale order

..and from the search results...
Sample 25104: Maintain the order of ID variables in the output data set created by PROC TRANSPOSE
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation