BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
1 REPLY 1
LAP
Quartz | Level 8 LAP
Quartz | Level 8
> 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 ;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 679 views
  • 0 likes
  • 2 in conversation