04-16-2014 09:16 AM
I have a set of observations with date, section, rank, and identifier. I want to have a report with a row for each rank, a column for each date, and the identifier as the value in the column.
How do I do this with PROC REPORT? What I've tried so far gives me a collection of rows with a 1 or a ',' in each column and the identifiers on the right side.
I defined Rank as an ORDER variable (tried GROUP) too. DATE as an ACROSS variable. I've tried the identifier as COMPUTED and as just a column. I tried it as an ANALYSIS variable but it's not numeric.
04-16-2014 09:33 AM
04-16-2014 09:40 AM
Yes, I have an explanation of why you need the "trick" on pages 4, 5 and 6 of this paper: http://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf -- basically, PROC REPORT needs a numeric variable to summarize in order to collapse the rows with the GROUP usage. So there has to be a numeric variable or a statistic like N (even if it's NOPRINT) in order for the character values to be placed underneath the ACROSS items.
04-16-2014 12:05 PM
That worked well. Now a follow-on question - If I added a variable for what they were ranked by (say sales), could I show ID and sales at the intersection of each date and rank?
04-16-2014 12:21 PM
You would need to change the syntax of your COLUMN statement. The PROC REPORT documentation shows how to use the comma operator with parentheses to group items under an ACROSS usage variable. Showing the code you've tried and a sample of your data would be very helpful. In addition, knowing your final ODS destination of choice (part of your code) would be helpful too.