Okay, so I am trying to get the results of proc univariate to export to a microsoft excel sheet. I need multiple ones. Currently, my code is:
%macro test2;
%do i = 1 %to 13;
%let v = %scan(&varsX,&i.);
ods html file="testfile.cls";
proc univariate data=test;
var &v;
run;
ods html close;
%end;
%mend test;
%test2;
where my variables are defined in a list above. This prints out a bunch of sheets saved as ASCII files, but I want them all as excel sheets in the same workbook.
Not tested but some thing like this should get you started:
%macro test3;
ods tagsets.excelxp file="testfile.xlm" options (sheet_interval='PROC');
%do i = 1 %to 13;
%let v = %scan(&varsX,&i.);
proc univariate data=test;
var &v;
run;
%end;
ods tagsets.excelxp close;
%mend test3;
%test3;
The XML file generated can be opended in Excel.
Not tested but some thing like this should get you started:
%macro test3;
ods tagsets.excelxp file="testfile.xlm" options (sheet_interval='PROC');
%do i = 1 %to 13;
%let v = %scan(&varsX,&i.);
proc univariate data=test;
var &v;
run;
%end;
ods tagsets.excelxp close;
%mend test3;
%test3;
The XML file generated can be opended in Excel.
Great, this puts them all in the same file with sheets which is awesome.
You have any idea how to keep a title in there because when I run this version of code it drops the titles.
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.