BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

I'm generating output .txt file via the following code and the starting position of each variable is as mentioned below. If you observe the following code you see that there is a big difference (Indeed it's right) in the starting position between the variables DIR (183) and P2RN (268). After the execution of the codeI could see that file has delivered the right output data between the first variable and the variable DIR after which the data for P2RN and the respective variables has gone to subsequent lines instead of delivering it in one line. Am I missing some options to correct the issue?

 

data _null_;
set temp;
file '$FSDU/data/traport/out/is_dwh/dummy.txt';
      
         put 
             @ 1 KHIEF  
             @ 21 KNOPD  
             @ 31 TLK  
             @ 32 KNRSG  
             @ 33 INKZK  
             @ 34 KNKKT  
             @ 35 NTD  
             @ 37 KDALD  
             @ 47 VTS  
             @ 50 BVLTD  
             @ 60 PORD  
             @ 70 KDEGD  
             @ 89 KNEIN  
             @ 90 KKBIN  
             @ 91 OKSYN  
             @ 92 KNKTAS  
             @ 93 KNKBZA  
             @ 94 MIK 
             @ 95 ZTK  
             @ 97 PSI 9. 
             @ 106 AGI  
             @ 112 KDET  
             @ 115 KBJN 12.2 
             @ 127 KNCW 12.2 
             @ 139 KNTKS 12.2 
             @ 151 KNKST 12.2 
             @ 163 AGABR  
             @ 169 POKTYD  
             @ 170 PDK  
             @ 172 KVPB  
             @ 174 GKSEC  
             @ 183 DIR  
             @ 268 P2RN  
             @ 298 KNJPB 12.2 
             @ 310 KKRT 12.2 
             @ 322 P2KPSH  
             @ 323 KNCOT 12.2 
             @ 335 KNB 12.2 
             @ 347 POK  
         ;
   
run; 

Actual output:

 

7000000008 2016-12-3120131 2016-11-281 2016-11-282018-11-012016-11-01 20002R10656239957100 999 45.11 10.16 . . . 21 0 9
50
45.11
.
1
11.16
12.16
0

 

Excepted Output:

 

7000000008          2016-12-3120131 2016-11-281  2016-11-282018-11-012016-11-01         20002R10656239957100   999       45.11       10.16         .           .  .     21 0          9 50 45.11 .  111.16 12.1 0

3 REPLIES 3
Babloo
Rhodochrosite | Level 12

I'm generating output .txt file via File writer transformation and the starting position of each variable is as mentioned below. If you observe the following code you see that there is a big difference (Indeed it's right) in the starting position between the variables DIR (183) and P2RN (268). After the execution of the transformation I could see that file has delivered the right output data between the first variable and the variable DIR after which the data for P2RN and the respective variables has gone to subsequent lines instead of delivering it in one line. Am I missing some options to correct the issue?

 

data _null_;
file '$FSDU/data/traport/out/is_dwh/dummy.txt';
      
         put 
             @ 1 KHIEF  
             @ 21 KNOPD  
             @ 31 TLK  
             @ 32 KNRSG  
             @ 33 INKZK  
             @ 34 KNKKT  
             @ 35 NTD  
             @ 37 KDALD  
             @ 47 VTS  
             @ 50 BVLTD  
             @ 60 PORD  
             @ 70 KDEGD  
             @ 89 KNEIN  
             @ 90 KKBIN  
             @ 91 OKSYN  
             @ 92 KNKTAS  
             @ 93 KNKBZA  
             @ 94 MIK 
             @ 95 ZTK  
             @ 97 PSI 9. 
             @ 106 AGI  
             @ 112 KDET  
             @ 115 KBJN 12.2 
             @ 127 KNCW 12.2 
             @ 139 KNTKS 12.2 
             @ 151 KNKST 12.2 
             @ 163 AGABR  
             @ 169 POKTYD  
             @ 170 PDK  
             @ 172 KVPB  
             @ 174 GKSEC  
             @ 183 DIR  
             @ 268 P2RN  
             @ 298 KNJPB 12.2 
             @ 310 KKRT 12.2 
             @ 322 P2KPSH  
             @ 323 KNCOT 12.2 
             @ 335 KNB 12.2 
             @ 347 POK  
         ;
   
run; 

Actual output:

 

7000000008 2016-12-3120131 2016-11-281 2016-11-282018-11-012016-11-01 20002R10656239957100 999 45.11 10.16 . . . 21 0 9
50
45.11
.
1
11.16
12.16
0

 

Excepted Output:

 

7000000008          2016-12-3120131 2016-11-281  2016-11-282018-11-012016-11-01         20002R10656239957100   999       45.11       10.16         .           .  .     21 0          9 50 45.11 .  111.16 12.1 0

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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