BookmarkSubscribeRSS Feed
Stephane
Quartz | Level 8

With my SAS 9.3M0 I would like to produce a SVG document with two graphs. Unfortunately, most of the elements of the second graphic is missing (the axis for example). Is it my code or is it a problem of SVGVIEW ?

ods html close;ods listing;
FILENAME fname "d:\data\analyse 2003.svg"; goptions reset=all device=svgview         

gsfmode=replace gsfname=mysvg;

proc sgplot data=sashelp.stocks;where year(date) =2003;

series y=Volume x=date / markers group=stockcurvelabel curvelabelloc=outside;xaxis fitpolicy=rotate tickvalueformat=monname.  grid label='Month';

yaxis label='Volume' ;title '2003 Volume';run;


proc sgplot data=sashelp.stocks (where=(year(date)=2000 and stock = "IBM"));

series x=date y=volume;run;

ods _all_ close;

Thanks for your help.

Stéphane.

4 REPLIES 4
Jay54
Meteorite | Level 14

SGPLOT (and other SG procedures) do not use information from GOPTIONS.  You need to use the ODS GRAPHICS statement with IMAGEFMT=SVG, and you will get the correct SVG output.  See code below.

ods html close;
ods listing;

ods graphics / reset imagefmt=svg imagename='test';
proc sgplot data=sashelp.stocks;where year(date) =2003;
  series y=Volume x=date / markers group=stock curvelabel curvelabelloc=outside;
  xaxis fitpolicy=rotate tickvalueformat=monname.  grid label='Month';
  yaxis label='Volume' ;title '2003 Volume';
run;

proc sgplot data=sashelp.stocks (where=(year(date)=2000 and stock = "IBM"));
  series x=date y=volume;
run;

Stephane
Quartz | Level 8

OK ...

and in this case, I don't use the GOPTIONS. But it is the same thing ?

ods listing close;

ods printer printer=svgview file="d:\data\analyse 2003.svg";

proc sgplot data=sashelp.stocks;

where year(date) =2003;

series y=Volume x=date / markers group=stock

curvelabel curvelabelloc=outside;

xaxis fitpolicy=rotate tickvalueformat=monname.  grid label='Month';

yaxis label='Volume' ;

title '2003 Volume';

run;

proc sgplot data=sashelp.stocks (where=(year(date)=2000 and stock = "IBM"));

series x=date y=volume;

run;

ods _all_ close;

DanH_sas
SAS Super FREQ

Currently, the ODS Graphics system does not support printerpath options. The method described by Sanjay should give you an SVG output either in LISTING or HTML.

Dan

Stephane
Quartz | Level 8

Hi Dan,

This is the SAS example

http://support.sas.com/documentation/cdl/en/lrcon/62753/HTML/default/viewer.htm#n0ezld96mjxs08n1lvoj...

Looks for  "Here is the SAS code that created the stocks.svg file" and you have a

printerpath=(svgview stocks) with several SGPLOT proc.

So ?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1610 views
  • 0 likes
  • 3 in conversation