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:
See the section "Creating a SAS Data Set from SAS/IML Vectors" in the following blog post: Writing data from a matrix to a SAS data set - The DO Loop
After it is in a SAS data set, use PROC EXPORT to convert to a format that Excel can read. For an example, see http://support.sas.com/resources/papers/proceedings12/247-2012.pdf
See the section "Creating a SAS Data Set from SAS/IML Vectors" in the following blog post: Writing data from a matrix to a SAS data set - The DO Loop
After it is in a SAS data set, use PROC EXPORT to convert to a format that Excel can read. For an example, see http://support.sas.com/resources/papers/proceedings12/247-2012.pdf
Thank you very much.
When I ran the following code, it gave me an error. Could you please help me with that.
CODE:
proc iml;
d = 0.4;
call farmasim(yt, d) n=10 sigma=2 seed=123457;
create MyData var {yt}; /** create data set **/
append; /** write data in vectors **/
close MyData; /** close the data set **/
proc print data=MyData;
run;
LIBNAME dat "c:\sas\data\";
PROC EXPORT DATA=MyData;
OUTFILE="F:\data\test.csv"
DBMS=csv REPLACE;
RUN;
ERROR:
788 LIBNAME dat "c:\sas\data\";
NOTE: Library DAT does not exist.
789
790 PROC EXPORT DATA=MyData;
ERROR: FILE= or TABLE= is required and must be specified.
NOTE: The SAS System stopped processing this step because of errors.
Thanks
Hi,
You don't need this line: /*LIBNAME dat "c:\sas\data\"; */ and the ";" after "PROC EXPORT DATA=MyData" is not needed.
proc iml;
d = 0.4;
call farmasim(yt, d) n=10 sigma=2 seed=123457;
create MyData var {yt}; /** create data set **/
append; /** write data in vectors **/
close MyData; /** close the data set **/
proc print data=MyData;
run;
PROC EXPORT DATA=MyData
OUTFILE="F:\data\test.csv"
DBMS=csv REPLACE;
RUN;
Thank you very much... I figured it out too. Anyway I really appreciate ur answer.
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 25. 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.