I've a data as follows. Now I've to create a pivot table via SAS program to know graphically how many tickets were worked by L2 and L3 as per chart below. I did tried this using proc summary and proc transpose, but I'm unable to get this work done using those procs. Appreciate if someone of you help me to achive this.
Count of L2/L3 | Column Labels | ||
Row Labels | L2 | L3 | Grand Total |
Week 1_Jul-3-9 | 4 | 4 | |
Week 2_Jul-10-16 | 7 | 4 | 11 |
Week 3_Jul 17-23 | 5 | 1 | 6 |
Grand Total | 16 | 5 | 21 |
Hi, as I explained, using STYLE= in your ODS statement will change the style:
For example:
ods rtf file='c:\temp\myfile.rtf' style=journal;
**... your code ...;
ods rtf close;
Where I have style=journal, you can change to any of the SAS-supplied styles you want:
style=journal
style=pearl
style=rtf
style=htmlblue
style=sasweb
... to name just a few --you'll have to experiment to see which style you want/like. But the bottom line is that the STYLE= option will go on the ODS statement -- that comes with colors predefined for grouping when you are doing graphs.
If you want to change the colors used, you can either:
1) change the style you use with the STYLE= option
2) use internal SGPLOT syntax for changing bar colors (you will find this in the documentation)
3) use an attribute map (part of ODS GRAPHICS) to change the colors (there are examples of this in the doc and in previous forum postings)
cynthia
Proc Summary should work, what do you have so far in terms of code.
Also, we see something, but it's not what you want and we don't know what you have so we don't have a lot of information here. You need to detail your question a lot more.
To make it simple, assume you've the data as follows in the SAS program and I just wanted to create a bar chart as shown below. Appreciate if could help me with the coding part.
data have;
input week $ L2 L3 Grant_total;
datalines;
week1 4 . 4
week2 7 4 11
week3 5 1 1
;
run;
Hi:
If you structure your data a bit differently -- so you have a "TYPE" variable that can be used for grouping and you only have one row for every type/week combo, like this:
data chart;
length Weekval $30;
infile datalines dlm=',' dsd;
input Weekval $ Amount Type $;
return;
datalines;
"Week 1_Jul-3-9", 4, L2
"Week 2_Jul-10-16", 7, L2
"Week 3_Jul 17-23", 5, L2
"Week 1_Jul-3-9", , L3
"Week 2_Jul-10-16", 4, L3
"Week 3_Jul 17-23", 1, L3
;
run;
Then it would be a very simple SGPLOT to do a VBAR chart.
cynthia
Great! It worked like a charm. Now I want to write a code to send an email to our group which has this chart and also the dataset 'Chart'. So that end user can understand the data and the chart. I know we can achive this using filename email statement. but I'm not certain how to do that. Appreciate if someone of you help me here.
Emailing is working for me. Is there any way to send an email which has chart (bar chart) and dataset in body of the email instead of attachment using Filename statement?
Hi, as I explained, using STYLE= in your ODS statement will change the style:
For example:
ods rtf file='c:\temp\myfile.rtf' style=journal;
**... your code ...;
ods rtf close;
Where I have style=journal, you can change to any of the SAS-supplied styles you want:
style=journal
style=pearl
style=rtf
style=htmlblue
style=sasweb
... to name just a few --you'll have to experiment to see which style you want/like. But the bottom line is that the STYLE= option will go on the ODS statement -- that comes with colors predefined for grouping when you are doing graphs.
If you want to change the colors used, you can either:
1) change the style you use with the STYLE= option
2) use internal SGPLOT syntax for changing bar colors (you will find this in the documentation)
3) use an attribute map (part of ODS GRAPHICS) to change the colors (there are examples of this in the doc and in previous forum postings)
cynthia
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.