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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 580 views
  • 0 likes
  • 2 in conversation