BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gskn4u
Obsidian | Level 7

Hello, 

 

I am working on one challenge and I am unable to resolve the error message. 

 

I have file1 with customer info:

 

cust#;date
1234;20200104
1234;20200105
1234;20200106
1233;20200204
1233;20200221
1233;20200213
1222;20200520
1222;20200522
1222;20200523

I have another file with a script:

ftp <server>
user pwd
cd /temp/folder/
  put filename_cust_dyymmdd     filename_cust_dyymmdd.txt

for each value in file1, I need to dynamically generate individual FTP scripts by replacing cust with cust# and yymmdd with date. 

 

I used array to load the script as shown in below code:

DATA script1                ;                      
   FORMAT LI1-LI4  $100.;                      
   RETAIN LI1-LI4 ;                           
   ARRAY LI{150}  $ ;                           
   INFILE script1   TRUNCOVER END=EOF;             
   INPUT @001 LI01   $100. ;                     
   I = _N_;                                     
   LI{I} = LI01;                                
   IF EOF THEN OUTPUT ;                         
RUN;                                            

and then 

 

data _null_
array li{4}   $;
format line     $100. ;
set file1;       /* cust# and date */
if _n_ = 1 then set script1;
for i = 1 to 4;
      line = li{i};
      if i = 4 then do;
string update/replace using substr
end; @001 put line $100.; end; run;
WARNING: Multiple lengths were specified for the variable LI1 by input data set(s). This can cause truncation of data.    

I am able to get multiple scripts as per file1 but values are truncated (only first 8 bytes are written) and not as expected. 

 

can someone help why I am getting truncation warning. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
gskn4u
Obsidian | Level 7
ARRAY LI{150 4}  $ ; 


ChrisNZ
Tourmaline | Level 20

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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