DATA Step, Macro, Functions and more

Writing Dataset to Excel

Reply
N/A
Posts: 0

Writing Dataset to Excel

Hi,

I have a Macro that writes dataset to Excel and creates different tabs in excel. I have fixed fields in excel as a columnwise like,

Sate
Country
Phone

I want the output to write next to the above fields columnwise. But when I run the job, only Sate value writes to excel.
*************
filename output dde "Excel|&a1.!r4c2:r7c2";
data _null_;
file OUTPUT;
set pclib.Test
put Sate Country Phone
RUN;
*************

I am pretty new to SAS and I appreciate any kind of help.

Thanks in advance.
Frequent Contributor
Frequent Contributor
Posts: 76

Re: Writing Dataset to Excel

> Hi,
>
> I have a Macro that writes dataset to Excel and
> creates different tabs in excel. I have fixed fields
> in excel as a columnwise like,
>
> Sate
> Country
> Phone
>
> I want the output to write next to the above fields
> columnwise. But when I run the job, only Sate value
> writes to excel.
> *************
> filename output dde "Excel|&a1.!r4c2:r7c2";
> data _null_;
> file OUTPUT;
> set pclib.Test
> put Sate Country Phone
> ;
> *************
>
> I am pretty new to SAS and I appreciate any kind of
> help.
>
> Thanks in advance.

I believe you need to place a tab between each of the output columns and use the notab option on the file statement.

file output notab;
put sate '09'x county '09'x phnone ;
Ask a Question
Discussion stats
  • 1 reply
  • 107 views
  • 0 likes
  • 2 in conversation