BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
1 REPLY 1
LinusH
Tourmaline | Level 20
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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 1 reply
  • 2636 views
  • 0 likes
  • 2 in conversation