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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: