BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8
I use the following code:
proc transpose data=adhoc2 out=Out1;
by boutique_src_cd ph_name BN_NAME ;
id date;
var total;
run;

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?
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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 site:sas.com

..and from the search results...
Sample 25104: Maintain the order of ID variables in the output data set created by PROC TRANSPOSE
http://support.sas.com/kb/25/104.html

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 684 views
  • 0 likes
  • 2 in conversation