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

Could you please help me with this problem?
I am making a scatterplot between ln-transformed levels of testosterone and score on a certain scale. But I need the axis for testosterone to reflect its actual values before transformation. How can I do it?

So far I have been using proc gplot, but as far as I understood from reading proc gplot syntax on support.sas.com I cannot do this in the axis statement. Here is my current code:

symbol1 color=red value=dot height=2 interpol=rl ;
symbol2 color=blue value=square height=2 interpol = rl;
axis1 label=("Testosterone (ng/g)");
axis2 label=(a=90 "Raw Score") order = (0 to 150 by 20);

proc gplot data=model;
plot score*ln_testosterone=sex / haxis=axis1 vaxis=axis2;
run; quit;

 

I would really appreciate any input!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I suspect you want to use LOGSTYLE=LOGEXPAND on the XAXIS statement, but maybe you want to use LOGSTYLE=LINEAR.

Here is a program that shows both so you can choose.

 

DATA have;
call streaminit(1);
cnt = 0;
do i = -1 to 3 by 0.4;
   testosterone = 10**i;
   Sex = ifc( mod(cnt,2), 'F', 'M' );
   cnt + 1;
   Score = i + rand("Normal");
   output;
end;
run;

ods graphics / attrpriority=NONE;
proc sgplot data=Have;
series x=testosterone y=Score / group=Sex markers;
xaxis type=log logstyle=logexpand;
run;

proc sgplot data=Have;
series x=testosterone y=Score / group=Sex markers;
xaxis type=log logstyle=linear  label="Testosterone (ng/g)";
yaxis label="Raw Score";
run;

 

And here's a link to the documentation for the XAXIS statement.

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

I suspect you want to use LOGSTYLE=LOGEXPAND on the XAXIS statement, but maybe you want to use LOGSTYLE=LINEAR.

Here is a program that shows both so you can choose.

 

DATA have;
call streaminit(1);
cnt = 0;
do i = -1 to 3 by 0.4;
   testosterone = 10**i;
   Sex = ifc( mod(cnt,2), 'F', 'M' );
   cnt + 1;
   Score = i + rand("Normal");
   output;
end;
run;

ods graphics / attrpriority=NONE;
proc sgplot data=Have;
series x=testosterone y=Score / group=Sex markers;
xaxis type=log logstyle=logexpand;
run;

proc sgplot data=Have;
series x=testosterone y=Score / group=Sex markers;
xaxis type=log logstyle=linear  label="Testosterone (ng/g)";
yaxis label="Raw Score";
run;

 

And here's a link to the documentation for the XAXIS statement.

Dinurik
Fluorite | Level 6

Thank you!

 

I tried this with scatter statement instead of series, and removes "markers" option. It worked. Thank you so much!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 815 views
  • 0 likes
  • 2 in conversation