BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
obertel
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
HB
Barite | Level 11 HB
Barite | Level 11

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

2 REPLIES 2
HB
Barite | Level 11 HB
Barite | Level 11

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

Madelyn_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

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