I am trying to write SAS code to prepare a dataset, send that dataset to R to produce and graph, and send that graph back to SAS to export through ODS. I ran the SAS code that is attached and got the following two error messages:
ARGUMENT '<D:\Documents and Settings\dbateman\Destkop\SAS to R to SAS\program.R>' __ignored__
ARGUMENT 'D:\Documents and Settings\dbateman\Desktop\SAS to R to SAS\program.log' __ignored__
Does anyone know what these mean and how to fix it? I cannot get SAS to run past the X statement and move on to the second DATA _NULL_ step.
I am not sure that my SAS code attached, so here it is just in case:
%let dir=D:\Documents and Settings\dbateman\Desktop\SAS to R to SAS;
file "&dir.\program.R" lrecl=1024;
put "png(file='D:/Documents and Settings/dbateman/Desktop/SAS to R to SAS/program.jpg')";
put 'barplot(height=brpercent,width=.5,space=0,col=color,ylim=(-100,125),ylab="Percent Change in Tumor Size")';
OPTIONS NOXWAIT XSYNC;
X """D:\Program Files\R\R-2.11.1\bin\Rgui.exe"" --no-save --quiet <""&dir.\program.R""> ""&dir.\program.log""";
put '**R: ' _infile_;
ods rtf file="&dir.\report.rtf" style=minimal gtitle gfootnote;
ods _ALL_ close;
It looks like you're trying to create a bar chart with a reference line. The VBAR and REFLINE statements in PROC SGPLOT are useful for this. Here's an example:
input Group $ Change;
format Change PERCENT8.;
title "Average Percent Change in Tumor Size";
proc sgplot data=tumors;
vbar group / response=change stat=mean;
refline 0 / axis=Y;
This does help somewhat. I am trying to make a waterfall plot. My SAS software does not have SAS/IML, and apparently I do not have access to PROC SGPLOT. I am not sure what our license agreement includes, but apparently not those two items. I managed to get something that looks fairly good (I will need to do a lot of adjusting) by using the following code:
proc gchart data=dsn;
vbar barnum / discrete type=sum sumvar=percentchange;
Well, good news when you upgrade to SAS 9.3:
1) The SG procedures are in Base SAS
2) PROC SGPLOT includes a WATERFALL statement: http://support.sas.com/documentation/cdl/en/grstatproc/62920/HTML/default/viewer.htm#p0djzh7ah4st4wn...
For earlier versions of SAS, there have been several papers written on how to do this using PROC GPLOT:
Robert Allison asked me to post this link that shows how to do a waterfall chart using traditional SAS/Graph (gchart, and a little annotate), which should work with any version of SAS shipped within the last 10 or 20 years…
I'll offer two comments:
1) You can seemlessly transfer data between SAS and R by using the SAS/IML language: http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#r_toc.htm I've written about the advantages of calling R from SAS/IML (http://blogs.sas.com/iml/index.php?/archives/140-Calling-R-from-SASIML-Software.html). The R language and the SAS/IML language are both high-level, extensible, matrix/vector languages. If you are tempted to compute something in R, chances are you can also compute it in SAS/IML. See my blog for example of using the SAS/IML language: http://blogs.sas.com/content/iml/
2) The advances in ODS graphics, and especially the Statistical Graphics (SG) procedures have eliminated many of the reasons that SAS customers used to give for using R. Perhaps if you describe the graph you are trying to produce, someone can show you how to create it within SAS.
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
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.