DATA Step, Macro, Functions and more

how to fix length exported data

Reply
N/A
Posts: 0

how to fix length exported data

I have sas data set to export to text but i want to fix lenght it ex.

var1 var2 var3 var4 var5
A, B , C, 100, 15000

I would like to fix lenght var1 = 1, var2 = 2 , var3 = 1 var4 = 9 var5 = 9
how i do ?

command

data _null_ ;
set a;
file '.....' dlm = ';' ;
put var1 var2 var3 var4 var5 ;
run;

output doesn't fix length
A;B;C;100;15000
i want fix length
A;B ;C;000000100;000150000 or
A;B ;C; 100; 150000

thanks in advance
Super User
Posts: 5,441

Re: how to fix length exported data

Posted in reply to deleted_user
By using @ you can specify fixed positions in your output (as well as input when reading files). And you will probably not need a delimiter if your file has fixed width fields.

data _null_ ;
set a;
file '.....';
put @1 var1 @10 var2 @39 var3 @40 var4 @45 var5 ;
run;

/Linus
Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 1387 views
  • 0 likes
  • 2 in conversation