02-09-2015 11:41 AM
I'm generating a report using proc report to output data split by month. The issue that I'm currently having is sorting the months across in order. There are 2 attachments, one to represent the code and the other which conveys the output. For the output, my initial assumption is that this has something to do with the first row where there are no values. I have tried to remedy this but unfortunately to no avail.
Would really appreciate any help on the matter if possible.
02-10-2015 06:12 AM
Better don't use character Date . and you padding blanks before them to get the order you want by proc format or override its value.
'DEC2014'=' DEC2014' ;
then add this format at proc report .
02-10-2015 11:09 AM
I've managed to get my final output in the right order, but cannot format the 'date1' variable to get in the form mmmyy(i.e. DEC14 etc...). For instance, I've added the lines of code below which has managed to sort them in order but not in 'mmmyy' form. I've tried to format this in the proc report using 'Format = mmmyy5.' in the define statement however this returns an error 'variable date1 must use character variable'.
date1 = put(UW_MTH, Julian5.);
/*Proc report section*/
define Date1 / descending across ' - Month -'
02-10-2015 12:42 PM
Sorry the question remains unanswered, not sure what happened, so please ignore the above.
I've tried using the raw variable in the proc report section it just outputs the same issue as previous where the months are not in order.
The date1 variable is a character variable (with the month values now in numerical from). Would I need to convert character type to date type to eliminate the Sas error as stated above?
02-10-2015 12:56 PM
It works on this absolutely useless report:
proc report data=sashelp.stocks;
columns stock date;
define date/across descending format=year4.;
Make sure to post your full code and sample data, perhaps something else is the issue.
02-11-2015 05:17 AM
I've posted this original discussion in a new thread named 'Proc Report Month Order' under ODS and Base Reporting, with additional material.
If you could have a look then it would be greatly appreciated,