Data visualization with SAS programming

Out put data set

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 91
Accepted Solution

Out put data set

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:


Accepted Solutions
Solution
‎10-27-2012 12:54 PM
SAS Super FREQ
Posts: 3,394

Re: Out put data set

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


All Replies
Solution
‎10-27-2012 12:54 PM
SAS Super FREQ
Posts: 3,394

Re: Out put data set

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

Frequent Contributor
Posts: 91

Re: Out put data set

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

Super Contributor
Posts: 1,636

Re: Out put data set

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;

Frequent Contributor
Posts: 91

Re: Out put data set

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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