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!
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.
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.
Thank you!
I tried this with scatter statement instead of series, and removes "markers" option. It worked. Thank you so much!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.