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

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]

dd.PNG

 

 

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?? 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

View solution in original post

2 REPLIES 2
ballardw
Super User

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;
PaigeMiller
Diamond | Level 26

Percentage of what? Please explain how to take the sample data you show and turn it into percentages.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1777 views
  • 0 likes
  • 3 in conversation