turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- vbar 2 columns created by catt or coalesceC

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-24-2017 11:50 AM

I have 2 columns (t1 and t2) created by catt or coalesceC from multiple columns (v1:v4) similar to the below.

v1 | v2 | v3 | v4 | t1 | t2 | |

1 | 1 | |||||

2 | 2 | |||||

3 | 3 | |||||

4 | --> | 4 | ||||

5 | 5 | |||||

7 | 7 | |||||

5 | 5 | |||||

8 | 8 |

I then run the following code.

```
proc sgplot have;
vbar t1;
vbar t2;
run;
```

Then I get the following error message that I don't understand.

ERROR: The same category variable must be used for summarized plots.

Accepted Solutions

Solution

10-25-2017
09:10 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-25-2017 09:10 AM

I finally found the solution I was looking for. Replace vbar in the above with vbarbasic as shown below:

```
proc sgplot data=have;
vbarbasic t1;
vbarbasic t2;
run;
```

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to capam

10-24-2017 12:36 PM

The error tells you pretty much everything. VBAR takes as first parameter a category variable for summarisation. You can only have one. Why have the data in two columns? Why not coalesce the t values an have a category variable:

v1 | v2 | v3 | v4 | T | cat | |

1 | 1 | 1 | ||||

2 | 2 | 2 | ||||

3 | 3 | 1 |

Then use cat as a group.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-24-2017 12:55 PM

Can you give an example?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to capam

10-24-2017 01:59 PM

There is plenty of examples out there, first google hit:

Also, you may find this blog helpful, it covers everything graph orientated.

Solution

10-25-2017
09:10 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-25-2017 09:10 AM

I finally found the solution I was looking for. Replace vbar in the above with vbarbasic as shown below:

```
proc sgplot data=have;
vbarbasic t1;
vbarbasic t2;
run;
```