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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 2723 views
  • 0 likes
  • 2 in conversation