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

 

proc format library=work;
value $Serving
'RN' = 'Nadal'
'RF' = 'Federer'
'ND'  = 'Djokovic'
'JI' = 'Isner'
;
run ;

*Lets combine the four datasets ;
data goats_isner ;
set isner_serve rafa_serve fed_serve djoker_serve ;
format Serving $Serving. ;
run ;

*Compare the four rallylen in one chart-fix format! ;
proc sgpanel data=goats_isner ;
panelby year ;
histogram rallylen / group=serving  dataskin=matte transparency=0.5 ;
label rallylen = "Rally Length" ;
keylegend / valueattrs = (Size=8) ;
title "Rally Length on Serve" ;
run ;

 

My code is above with some output of the data below along with the generated plot. I got marked for spam but I am genuinely stuck on this. The output is cutting short on the legend labels to 4 characters but it reads in fine using the format I created so I am not sure why that is happening. I get "fede" instead of the entire "Federer" as I coded in the plot but my dataset reads it correctly So I am not sure why this is the case. 

 

Am a newbie here so I apologize for any lack of clarity in my post

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I am unable to open your attachments. I don't know if you did something wrong or my firewall is blocking them.

--
Paige Miller

View solution in original post

5 REPLIES 5
Jagadishkatam
Amethyst | Level 16
/*moved the format $seving on serving variable from data step to proc sgpanel*/

proc format library=work; value $Serving 'RN' = 'Nadal' 'RF' = 'Federer' 'ND' = 'Djokovic' 'JI' = 'Isner' ; run ; *Lets combine the four datasets ; data goats_isner ; set isner_serve rafa_serve fed_serve djoker_serve ; run ; *Compare the four rallylen in one chart-fix format! ; proc sgpanel data=goats_isner ; panelby year ; histogram rallylen / group=serving dataskin=matte transparency=0.5 ; label rallylen = "Rally Length" ; keylegend / valueattrs = (Size=8) ;
format serving $serving.; title "Rally Length on Serve" ; run ;

 

Thanks,
Jag
banderson2112
Calcite | Level 5

Thanks Jag, I tried that earlier and just now and it still yields the same result unfortunately so it doesnt work

PaigeMiller
Diamond | Level 26

I am unable to open your attachments. I don't know if you did something wrong or my firewall is blocking them.

--
Paige Miller
banderson2112
Calcite | Level 5

PlotPlotPart of dataset GOATS_ISNERPart of dataset GOATS_ISNER

Hope this helps, sorry about that they are working for me

banderson2112
Calcite | Level 5
I figured it out! Needed to change the length of the variable in the GOATS_ISNER dataset prior to using the '$Serving' format afterwards. Appreciate the help!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 3459 views
  • 0 likes
  • 3 in conversation