Hi,
I am using below code for generating forest plot, very new to plotting, I only have 9.3 SAS and the report should be in RTF.
proc sgplot data=indata;
scatter x=perc y=dptxt / xerrorlower=lo xerrorupper=hi markerattrs=(symbol=circleFilled color=black);
refline 0 / axis=x lineattrs=(color=grey pattern=20);
xaxis label="LSMean difference and 95% CI" min=-0.4;
yaxis label="Subgroup Category";
run;
the value labels are currently "All patient ^ (n=XX:xx vs n=YY:yy)" and "Group1 vs Group4 ^ (n=XX:xx vs n=YY:yy)"
even after using SPLITCHAR='^', fitpolicy in Yaxis attribute in SGPLOT and ods escapechar = '~'; somehow the axis label is not getting separated.
I have tried multiple other things but I am unsuccessful in the same, can anyone help please
I have no problem.
data x; y="All patient ^ (n=XX:xx vs n=YY:yy) ";x=1;output; y="Group1 vs Group4 ^ (n=XX:xx vs n=YY:yy)"; x=2;output; run; proc sgplot data=x; scatter x=x y=y; yaxis fitpolicy=splitalways splitchar='^' splitjustify=left; run;
HI, I tried the same code with multiple instances, but every time I am getting the same error. Always!
19483 data x;
19484 y="All patient ^ (n=XX:xx vs n=YY:yy) ";x=1;output;
19485 y="Group1 vs Group4 ^ (n=XX:xx vs n=YY:yy)"; x=2;output;
3 The SAS System 05:23 Monday, July 22, 2019
19486 run;
NOTE: The data set WORK.X has 2 observations and 2 variables.
NOTE: Compressing data set WORK.X increased size by 100.00 percent.
Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
19487
19488 proc sgplot data=x;
19489 scatter x=x y=y;
19490 yaxis fitpolicy=splitalways splitchar='^' splitjustify=left;
-----------
79
76
ERROR 79-322: Expecting a THIN.
ERROR 76-322: Syntax error, statement will be ignored.
19491 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
I don't know why you can't run the code. Here is my LOG . I am running SAS Academic On-Demand .
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 68 69 data x; 70 y="All patient ^ (n=XX:xx vs n=YY:yy) ";x=1;output; 71 y="Group1 vs Group4 ^ (n=XX:xx vs n=YY:yy)"; x=2;output; 72 run; NOTE: 数据集 WORK.X 有 2 个观测和 2 个变量。 NOTE: “DATA 语句”所用时间(总处理时间): 实际时间 0.00 秒 用户 CPU 时间 0.00 秒 系统 CPU 时间 0.00 秒 内存 662.31k OS 内存 25508.00k 时间戳 2019-07-22 下午12:13:21 Step Count 32 Switch Count 1 页错误数 0 页回收数 129 页交换数 0 主动上下文切换数 6 被动上下文切换数 0 块输入操作数 0 块输出操作数 264 73 74 proc sgplot data=x; 75 scatter x=x y=y; 76 yaxis fitpolicy=splitalways splitchar='^' splitjustify=left; 77 run; NOTE: “PROCEDURE SGPLOT”所用时间(总处理时间): 实际时间 0.23 秒 用户 CPU 时间 0.04 秒 系统 CPU 时间 0.01 秒 内存 7607.59k OS 内存 31276.00k 时间戳 2019-07-22 下午12:13:21 Step Count 33 Switch Count 1 页错误数 0 页回收数 1582 页交换数 0 主动上下文切换数 146 被动上下文切换数 0 块输入操作数 0 块输出操作数 464 NOTE: 从数据集 WORK.X. 读取了 2 个观测 78 79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 90
I know what is going on. You are using low version SAS 9.3. Try this one .
data x;
y="All patient"||'0D0A'x||" (n=XX:xx vs n=YY:yy) ";x=1;output;
y="Group1 vs Group4"||'0D0A'x||" (n=XX:xx vs n=YY:yy)"; x=2;output;
run;
proc sgplot data=x;
scatter x=x y=y;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.