Dear Sas community.
I am trying to create Line chart. Pplease help me how to get one line chart for each month beginning with August(8).
here is the example of data set.
PAT | Month | Frequency | Percent | Cumulative Frequency | Cumulative Percent |
Adm | 8 | 8728 | 0.09 | 295344 | 3.15 |
Adm | 9 | 20970 | 0.22 | 316314 | 3.37 |
Adm | 10 | 31085 | 0.33 | 347399 | 3.70 |
Adm | 11 | 32853 | 0.35 | 380252 | 4.05 |
Adm | 12 | 37680 | 0.40 | 417932 | 4.46 |
Selection | 8 | 9936 | 0.11 | 427868 | 4.56 |
Selection | 9 | 15093 | 0.16 | 442961 | 4.72 |
Selection | 10 | 17836 | 0.19 | 460797 | 4.91 |
Selection | 11 | 24004 | 0.26 | 484801 | 5.17 |
Selection | 12 | 8297 | 0.09 | 493098 | 5.26 |
Downloads | 8 | 4537 | 0.05 | 497635 | 5.31 |
Downloads | 9 | 1981 | 0.02 | 499616 | 5.33 |
Downloads | 10 | 1936 | 0.02 | 501552 | 5.35 |
Downloads | 11 | 13041 | 0.14 | 514593 | 5.49 |
Downloads | 12 | 21882 | 0.23 | 536475 | 5.72 |
My | 8 | 87 | 0.00 | 536562 | 5.72 |
My | 9 | 12 | 0.00 | 536574 | 5.72 |
My | 10 | 46 | 0.00 | 536620 | 5.72 |
My | 11 | 26938 | 0.29 | 563558 | 6.01 |
My | 12 | 77633 | 0.83 | 641191 | 6.84 |
Tools | 8 | 357758 | 3.81 | 998949 | 10.65 |
Tools | 9 | 551976 | 5.89 | 1550925 | 16.54 |
Tools | 10 | 786950 | 8.39 | 2337875 | 24.93 |
Tools | 11 | 530877 | 5.66 | 2868752 | 30.59 |
Tools | 12 | 142057 | 1.51 | 3010809 | 32.10 |
Reg | 8 | 12218 | 0.13 | 3023027 | 32.23 |
Reg | 9 | 58087 | 0.62 | 3081114 | 32.85 |
Reg | 10 | 47142 | 0.50 | 3128256 | 33.35 |
Reg | 11 | 16888 | 0.18 | 3145144 | 33.53 |
Reg | 12 | 67524 | 0.72 | 3212668 | 34.25 |
de | 8 | 32957 | 0.35 | 3245625 | 34.60 |
de | 9 | 49913 | 0.53 | 3295538 | 35.14 |
de | 10 | 68239 | 0.73 | 3363777 | 35.86 |
de | 11 | 95197 | 1.01 | 3458974 | 36.88 |
de | 12 | 228074 | 2.43 | 3687048 | 39.31 |
ef | 8 | 14 | 0.00 | 3687062 | 39.31 |
ef | 9 | 37 | 0.00 | 3687099 | 39.31 |
ef | 10 | 210047 | 2.24 | 3897146 | 41.55 |
ef | 11 | 96482 | 1.03 | 3993628 | 42.58 |
ef | 12 | 1927 | 0.02 | 3995555 | 42.60 |
field | 8 | 3520 | 0.04 | 3999075 | 42.64 |
field | 9 | 3381 | 0.04 | 4002456 | 42.67 |
field | 10 | 3141 | 0.03 | 4005597 | 42.71 |
field | 11 | 31490 | 0.34 | 4037087 | 43.04 |
field | 12 | 60040 | 0.64 | 4097127 | 43.68 |
fs | 8 | 20467 | 0.22 | 4117594 | 43.90 |
fs | 9 | 3273 | 0.03 | 4120867 | 43.94 |
fs | 10 | 862 | 0.01 | 4121729 | 43.95 |
fs | 11 | 571 | 0.01 | 4122300 | 43.95 |
fs | 12 | 439 | 0.00 | 4122739 | 43.96 |
my1 | 8 | 51145 | 0.55 | 4173884 | 44.50 |
my2 | 9 | 249220 | 2.66 | 4423104 | 47.16 |
my3 | 10 | 276931 | 2.95 | 4700035 | 50.11 |
my4 | 11 | 125847 | 1.34 | 4825882 | 51.45 |
my5 | 12 | 2685441 | 28.63 | 7511323 | 80.09 |
NFL2017 | 8 | 86837 | 0.93 | 7598160 | 81.01 |
NFL2018 | 9 | 181712 | 1.94 | 7779872 | 82.95 |
NFL2019 | 10 | 179133 | 1.91 | 7959005 | 84.86 |
NFL2020 | 11 | 152165 | 1.62 | 8111170 | 86.48 |
NFL2021 | 12 | 1267920 | 13.52 | 9379090 | 100.00 |
thanks
Which variables do you want plotted? What variable would go on the X axis? the y axis? Which variable(s) if any other than month to identify the series?
The basic approach is going to be:
Proc sgplot data=have;
series x=xvariable y=yvariable/ group=month ; /* guessing from your question*/
run;
Which variables do you want plotted? What variable would go on the X axis? the y axis? Which variable(s) if any other than month to identify the series?
The basic approach is going to be:
Proc sgplot data=have;
series x=xvariable y=yvariable/ group=month ; /* guessing from your question*/
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.