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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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