BookmarkSubscribeRSS Feed
Fadice
Fluorite | Level 6

I am having problems with my code. I have formatted my data yet when I run my sgplot  the correct formats do not show. Is there anyway I can get the yaxis labels on the graph to be formatted correctly?

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

@Fadice welcome to the SAS Communities 🙂

 

Can you show us your code please?

Fadice
Fluorite | Level 6

ODS OUTPUT "ODDS RATIOS"=ORCI;

PROC LOGISTIC DATA= HS DESCENDING;

class  heat_stroke  (ref='0') LOS (ref='1')  AGE_GROUP (ref='2') SEX (ref='1')

installation (ref='1') RACE_CODE (ref='1') branch (ref='1') pay_grade

(ref='1')/ param=ref;

MODEL heat_stroke= SEX AGE_GROUP pay_grade RACE_CODE branch installation LOS;

RUN;

 

DATA ORCI;

SET ORCI;

EFFECT=UPCASE(EFFECT);

RUN;

 

TITLE "SGPLOT:FOREST PLOT";

PROC SGPLOT DATA=ORCI;

SCATTER X=ODDSRATIOEST Y=EFFECT / XERRORLOWER=LOWERCL

                                                                                                                                  XERRORUPPER=UPPERCL

                                                                                                                                  MARKERATTRS=OR

                                                                                                                                  (SYMBOL=DIAMONDFILLED SIZE=8);

REFLINE 1 / AXIS=X;

XAXIS LABEL='OR AND 95% CI' MIN=0;

YAXIS LABEL='COVARIATES';

RUN;

PeterClemmensen
Tourmaline | Level 20

From what I can see, the yaxis variable EFFECT is not formatted. How would you like to have the values displayed?

Fadice
Fluorite | Level 6

sex

1='Male'

2= 'Female;

 

pay_grade

1= 'E1-E4'

2 ='E5-E9'

3 ='O1-O4'

4= 'O5-O9'

5= 'W1-W4'

6= 'Cadet'

 

 

PeterClemmensen
Tourmaline | Level 20

Also, is there any reason you want to create this graph with PROC SGPLOT?

 

You can do it directly in PROC LOGISTICS as in the documentation example below

 

https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_logistic_examples02.htm&docsetVer...

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
  • 1257 views
  • 0 likes
  • 2 in conversation