I have the following data.
I would like to create line graph by group and percent by group
Sample dataset:
ID | group | event_days |
1 | group_2 | 32 |
2 | group_1 | 26 |
2 | group_4 | 27 |
3 | group_1 | 26 |
3 | group_2 | 17 |
3 | group_3 | 20 |
4 | group_2 | 17 |
4 | group_3 | 19 |
5 | group_3 | 14 |
6 | group_2 | 32 |
6 | group_3 | 12 |
Output [this data won't match]
proc gplot data=sample;
plot (yvar1 yvar2 yvar3)*xvar / overlay legend=legend1
haxis=axis1 vaxis=axis2;
run;
quit;
I am not sure how to do percentage first??
Percentage of what? Total number of event days? Percent change between groups? Ids? Need to know what the numerator and denominator for each value would be.
You will have to calculate the desired percentage prior to graphing.
And time to move to SGPLOT instead of Gplot. Which might look something like this after you add the appropriate percentage value.
proc sgplot data=have; series x=event_days y=percent/group=group markers; run;
Percentage of what? Total number of event days? Percent change between groups? Ids? Need to know what the numerator and denominator for each value would be.
You will have to calculate the desired percentage prior to graphing.
And time to move to SGPLOT instead of Gplot. Which might look something like this after you add the appropriate percentage value.
proc sgplot data=have; series x=event_days y=percent/group=group markers; run;
Percentage of what? Please explain how to take the sample data you show and turn it into percentages.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.