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