I appreciate assistance with the following:
This procedure is running fine, but the plot is not showing and I am not getting an error message:
ods graphics on;
proc surveyreg ;
cluster school;
class age ;
model ratio_a = age/ vadjust=none;;
lsmeans age / diff plots=(diff meanplot(cl));
format age age. ;
run;
ods graphics off;
Below is information about the sas system I am using:
NOTE: This session is executing on the X64_8PRO platform.
NOTE: Updated analytical products:
SAS/STAT 12.3 (maintenance)
SAS/ETS 12.3 (maintenance)
SAS/OR 12.3 (maintenance)
SAS/IML 12.3 (maintenance)
SAS/QC 12.3 (maintenance)
NOTE: Additional host information:
X64_8PRO WIN 6.2.9200 Workstation
If you don't see the graph in my code, it isn't your data.
I assume you are running this interactively, right? What interface are you using?
I see you are running SAS/STAT 12.3, but I believe that the LSMEANS statement supported the DiffPlot and MeansPlot in 12.3.
Can you generate any plots? Try running a PROC REG step.
If you don't see plots from PROC REG, check that your ODS destinations are opened and that the select path is not empty. For example:
ODS SHOW; /* show the overall exclude list */
NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M0)
Licensed to XXXXXXXXXXXXXXXXXXXXXXX
NOTE: This session is executing on the X64_8PRO platform.
NOTE: Updated analytical products:
SAS/STAT 12.3 (maintenance)
SAS/ETS 12.3 (maintenance)
SAS/OR 12.3 (maintenance)
SAS/IML 12.3 (maintenance)
SAS/QC 12.3 (maintenance)
NOTE: Additional host information:
X64_8PRO WIN 6.2.9200 Workstation
NOTE: SAS initialization used:
real time 5.54 seconds
cpu time 2.17 seconds
1
2 OPTIONS NODATE number=no ls=120;
3
4 libname lib
5 XXXXXXXXXXXXXXXXXXXXXXX
NOTE: Libref LIB was successfully assigned as follows:
Engine: V9
Physical Name: XXXXXXXXXXXXXXXXXXXXXXX
6
7 data tiz;
8 set lib.tizbac;
9 run;
NOTE: There were 80 observations read from the data set LIB.TIZBAC.
NOTE: The data set WORK.TIZ has 80 observations and 36 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
10
11 proc format ;
12 value age 8-14='C) 12-14y' 14-16='B) 15-16y' 16-26='A) 17-20y';
NOTE: Format AGE has been output.
13 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
14
15 ods graphics on;
16 proc surveyreg ;
17 cluster school;
18 class age ;
19 model ratio_aa = age/ vadjust=none;
20 lsmeans age / diff plots=(diff meanplot);
21 format age age. ;
22 run;
NOTE: PROCEDURE SURVEYREG used (Total process time):
real time 0.78 seconds
cpu time 0.31 seconds
23 ods graphics off;
This is the full log (just removed the identification text):
NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M0)
Licensed to XXXXXXXXXXXXXXXXXXXXXXX
NOTE: This session is executing on the X64_8PRO platform.
NOTE: Updated analytical products:
SAS/STAT 12.3 (maintenance)
SAS/ETS 12.3 (maintenance)
SAS/OR 12.3 (maintenance)
SAS/IML 12.3 (maintenance)
SAS/QC 12.3 (maintenance)
NOTE: Additional host information:
X64_8PRO WIN 6.2.9200 Workstation
NOTE: SAS initialization used:
real time 5.54 seconds
cpu time 2.17 seconds
1
2 OPTIONS NODATE number=no ls=120;
3
4 libname lib
5 XXXXXXXXXXXXXXXXXXXXXXX
NOTE: Libref LIB was successfully assigned as follows:
Engine: V9
Physical Name: XXXXXXXXXXXXXXXXXXXXXXX
6
7 data tiz;
8 set lib.tizbac;
9 run;
NOTE: There were 80 observations read from the data set LIB.TIZBAC.
NOTE: The data set WORK.TIZ has 80 observations and 36 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
10
11 proc format ;
12 value age 8-14='C) 12-14y' 14-16='B) 15-16y' 16-26='A) 17-20y';
NOTE: Format AGE has been output.
13 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
14
15 ods graphics on;
16 proc surveyreg ;
17 cluster school;
18 class age ;
19 model ratio_aa = age/ vadjust=none;
20 lsmeans age / diff plots=(diff meanplot);
21 format age age. ;
22 run;
NOTE: PROCEDURE SURVEYREG used (Total process time):
real time 0.78 seconds
cpu time 0.31 seconds
23 ods graphics off;
Anyone with a clue on why the graph is not showing?
Thanks.
Run the following code and let me know if you see the MeanPlot and the DiffPlot.
proc surveyreg data=sashelp.cars(where=(type in ('Sedan', 'SUV', 'Truck')));
cluster origin;
class type ;
model mpg_city = type/ vadjust=none;
lsmeans type / diff plots=(diff meanplot);
run;
If not, there might be something strange with your data. Maybe missing groups? Run the following and let us know what you see
proc freq data=tiz;
tables school*age;
format age age. ;
run;
If you don't see the graph in my code, it isn't your data.
I assume you are running this interactively, right? What interface are you using?
I see you are running SAS/STAT 12.3, but I believe that the LSMEANS statement supported the DiffPlot and MeansPlot in 12.3.
Can you generate any plots? Try running a PROC REG step.
If you don't see plots from PROC REG, check that your ODS destinations are opened and that the select path is not empty. For example:
ODS SHOW; /* show the overall exclude list */
Which ODS Destination are you sending the output to? If you only have the LISTING destination open then ODS Graphics don't appear. You need something like ODS HTML; ODS RTF or ODS PDF thought these last two would be external documents and would not likely open until an ODS RTF or PDF CLOSE is encountered.
Thank you all very much. Yes, I did not declare a destination for the ODS. I thought it will just show on my screen and then I save it. I don't do graphs that often, so I forgot.
Thanks a gain.
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.
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.