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 ;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 923 views
  • 0 likes
  • 2 in conversation