Hi,
Can some one please help me to output the data generated from the following code(yt) to an excel data set?
proc iml;
d = 0.4;
call farmasim(yt, d) n=10 sigma=2 seed=123457;
print yt;
run;
Thanks:
Hi malakaext,
As far as I know you can't directly export to Excel but there is a way to do that using PROC EXPORT.
The SAS/IML code that you should use is:
proc iml;
start main;
d = 0.4;
call farmasim(yt, d) n=10 sigma=2 seed=123457;
* Creates the dataset yt in the work library;
create work.yt from yt;
append from yt;
finish main;
* Execute the code defined in the main module;
run main;
quit;
Once the dataset is in the work directory you can use PROC EXPORT. If you have SAS Interface to Microsoft products you will be able to export directly to Excel (*.xls file), if not you will be still able to export a CSV (directly readable in Excel). This is possible because SAS foundation includes SAS Interface to PC FILES.
In order to see if SAS Interface to Microsoft Office is included in your licence you can try to run this procedure and check in the log if you can find the interface:
proc setinit;
run;
* This procedure is going to create a CSV file in C: directory. If you want to create an Excel file you can change the extension to .xls;
proc export outfile="C:\yt.csv"
data = work.yt
replace;
run;
Hope it helps!
Francesco
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 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.