BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
malakaext
Calcite | Level 5

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:

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

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

malakaext
Calcite | Level 5

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

Linlin
Lapis Lazuli | Level 10

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;

malakaext
Calcite | Level 5

Thank you very much... I figured it out too. Anyway I really appreciate ur answer.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1264 views
  • 3 likes
  • 3 in conversation