Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Newbie: How to swap row and columns in list table in Visual Analytics 7.3?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

Newbie: How to swap row and columns in list table in Visual Analytics 7.3?

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


Accepted Solutions
Solution
‎12-05-2017 01:57 AM
Super Contributor
Super Contributor
Posts: 269

Re: Newbie: How to swap row and columns in list table in Visual Analytics 7.3?

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

View solution in original post


All Replies
Solution
‎12-05-2017 01:57 AM
Super Contributor
Super Contributor
Posts: 269

Re: Newbie: How to swap row and columns in list table in Visual Analytics 7.3?

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

SAS Super FREQ
Posts: 590

Re: Newbie: How to swap row and columns in list table in Visual Analytics 7.3?

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 387 views
  • 0 likes
  • 3 in conversation