08-14-2015 04:44 PM
Hi,
Guys, i need to create a external txt file with finame and file statements as follows:
filename out "/home/mm14532/sasuser.v92/FRAUDEEM.txt";
data _null_; set ABECS_V4;
file out ;
put "/home" #2 @2 POS_MODE_OLA @3 DOM_INT @4 PAIS @54 OLA_MIS_MERCH_CAT @58 QUANTIDADE @70 VALOR @85 TIP_PESS @87 FORM_PAG @88 ANO @92 MES;
run;
This code is working well, but i need a way to put at the first line of this external file a string or a title.
I've tried using #2 to go to the second line but it didn't worked.
How can i do that ?
Thank you before anything
Rodrigo Elias
08-14-2015 05:12 PM
Not tested, but can you just add a line:
filename out "/home/mm14532/sasuser.v92/FRAUDEEM.txt";
data _null_; set ABECS_V4;
file out ;
if _n_=1 then put "/home" ;
else put @2 POS_MODE_OLA @3 DOM_INT @4 PAIS @54 OLA_MIS_MERCH_CAT @58 QUANTIDADE @70 VALOR @85TIP_PESS @87 FORM_PAG @88 ANO @92 MES;
run;
08-14-2015 05:07 PM
filename out "/home/mm14532/sasuser.v92/FRAUDEEM.txt";
data _null_;
set ABECS_V4;
file out ;
if _n_ = then put "stuff here will be the first line in the output file";
put "/home" @2 POS_MODE_OLA @3 DOM_INT @4 PAIS @54 OLA_MIS_MERCH_CAT @58 QUANTIDADE @70 VALOR @85 TIP_PESS @87 FORM_PAG @88 ANO @92 MES;
run;
The automatic variable _n_ relates to the record currently being read from the dataset on the set statement.
You could use it for all kinds of conditional processing for old school output like this.
Examples:
if mod(_n_,80) = 0 then put "this is a multiple of 80 lines in the file";
or put the values of some specific variables, possibly you've been accumulating totals...
08-14-2015 05:12 PM
Not tested, but can you just add a line:
filename out "/home/mm14532/sasuser.v92/FRAUDEEM.txt";
data _null_; set ABECS_V4;
file out ;
if _n_=1 then put "/home" ;
else put @2 POS_MODE_OLA @3 DOM_INT @4 PAIS @54 OLA_MIS_MERCH_CAT @58 QUANTIDADE @70 VALOR @85TIP_PESS @87 FORM_PAG @88 ANO @92 MES;
run;
Need further help from the community? Please ask a new question.