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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.