Hi
I'm struggling with a simple task. Having one category (year/month) and two measures, I want to create a report with year/month in the columns and the two measures in the rows.
Default the list table object looks like this:
Measure1 Measure2
2017-jan 10 20
2017-feb 15 10
2017-mar 11 12
2017-...
The requirement is to swap the rows and columns to get this result:
2017-jan 2017-feb 2017-mar 2017-...
Measure1 10 15 11
Measure2 20 10 12
I have already looked into crosstab but it doesn't seem to give the required result.
I'm using SAS Visual Analytics 7.3.
Any suggestions?
Thanks
/Ole
See if this gets you started:
data measures;
input mydate:mmddyy10. measure1 measure2;
format mydate mmddyy10.;
datalines;
1/1/2017 10 20
2/1/2017 15 10
3/1/2017 11 12
;
run;
proc transpose data = measures out = measures_transposed;
id mydate;
run;
proc print noobs;
run;
The SAS System 10:14 Friday, December 1, 2017 10
_01_01_ _02_01_ _03_01_
_NAME_ 2017 2017 2017
measure1 10 15 11
measure2 20 10 12
See if this gets you started:
data measures;
input mydate:mmddyy10. measure1 measure2;
format mydate mmddyy10.;
datalines;
1/1/2017 10 20
2/1/2017 15 10
3/1/2017 11 12
;
run;
proc transpose data = measures out = measures_transposed;
id mydate;
run;
proc print noobs;
run;
The SAS System 10:14 Friday, December 1, 2017 10
_01_01_ _02_01_ _03_01_
_NAME_ 2017 2017 2017
measure1 10 15 11
measure2 20 10 12
In 7.3, measures cannot be on the rows in a crosstab. The ability to put measures on the rows is planned for 8.2, although features for software in development are not guaranteed.
-------------------------------------------------------------------------
Four tips to remember when you contact SAS Technical Support
Tricks for SAS Visual Analytics Report Builders
SAS Visual Analytics Learning Center
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.