BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello All

I'm not sure, where should I post message about Data Integration Studio, so I'll try to do it here.

I use FileWriter in DIS to copy table to text file. It works good, but I need to add column names in first line. Help please, if somebody knows how to do it.

If nobody knows, than it will be great if you write a piece of code which will do this.

Thank you
2 REPLIES 2
deleted_user
Not applicable
Hi again
I have already found the solution of my question.
It is necessary to add the next code to user written code in FileWriter.

data _null_;
set &syslast;

attrib Field1 length = 8;
attrib Field2 length = $40;
attrib Field3 length = 8 format = commax16.2;

file "D:\MyFolder\FileName.txt" dlm = ";";

if _n_ = 1 then put 'Field1;Field2;Field3';

put Field1
Field2
Field3;

run;
deleted_user
Not applicable
Ihor

you might like to build a generic "transform" as a proc print report using ODS to write to CSV. By default, you can get all columns written with even simpler code, like :[pre]
ods close _all_ ;
ods csv file= "&_extfile" /* pulled from generic report surface */
proc print data= &_input1 /* pulled from generic report surface */
noobs ;
var _all_ ;
run;
ods _all_ close ;
ods listing ;
[/pre]
Although, for all columns, you really don't need that VAR statement, I placed it there as a reminder that you can probably use the DI Studio surface to select the columns you want to be written, and these would be placed in a macro variable you would use like [pre] VAR &_columns ;
[/pre]
Good Luck

PeterC

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1316 views
  • 0 likes
  • 1 in conversation