BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aero
Obsidian | Level 7
 
Hello All.  I'm back again.  
 
My code below works, but it cuts off much earlier than the max length I set it for.  

Whenever the date_time stamp is concatenated with it, it appears not to be able to take the full string for seq 1 (line one) of each note.

I came across another post saying that if there is a where clause in the statement then cats and cat() can only handle $200 length.  This is a huge problem for me as I can't have the middle of messages just drop off.

 

Can anyone think of a way where I can:

 

a)  conditionally insert a record for each (ID Time_STAMP) combination that I could then run the following code on where it would not be subject to this constraint?

 

b) concat the timestamp to the begining of the note without using my if seq=1 line (that I think is causing the limit of characters

 

c) redistribute the the text that would be cut off, to the next line, on and on down to the last line

 

d)re-arrange my code in a way that would still make this work and would not be subject to the the text cutting off before 32767 character limit.

 

 

Here's an example of what's happening (and see pic below and excel document attached containing what's in the picture):

 

Survey     ID    date_time       Seq      time_key           Textx

123          1      sasdatetime1   1         sastime1          Hello

123          1      sasdatetime1   2        sastime1           World

123           1     sasdatetime2   1        sastime2           Good

123           1     sasdatetime2   2        sastime2           Bye

....

so what the code below produces is:

123     1         sasdatetime 1        2     sastime1       (sastime1) Hel World

 

 (See actual) case in attached excel document.  Although I've set textx and new_text fields for 

length new_text $32767;

 

.Sample for SasForum.jpg

 

 

 

data notes;
set other.SUPPLY_NOTES;
length Textx $32767;
keep ID Survey SEQ Textx Item_Steps time_key date_time;
If (SEQ=1 and item_steps not in ("","."," ")) 
then do textx=cat('(',put(date_time,datetime18.),') ','||',"ITEM: ",ITEM_Steps,' || ',textx);
end; data notes; set other.SUPPLY_NOTES; keep ID Survey SEQ Textx Item_Steps time_key date_time; where survey="115"; run;
proc sort data=notes; by id time_key SEQ; Run;
proc sort data=itemnotes; by id time_key SEQ; Run;
data notesconcat; set notes; by ID time_key Seq; length new_text $32767; retain new_text; new_text=catx(' ',new_text,textx); if last.id then do; output; call missing(new_text); drop line Textx; end; run;

 

Thank you all for your assistance in advance!

 
 
1 ACCEPTED SOLUTION

Accepted Solutions
aero
Obsidian | Level 7

I figured it out.  Apparently the source table was imposing a limit on the textx variable of 60 characters.  When I concatenated date_time to the values with seq=1 it would exceed 60char and drop the remaining characters before concatenating the next line.

View solution in original post

2 REPLIES 2
Reeza
Super User

No attachment. 

Can you post data/code that replicates your issue please. You should be able to go up to length 32K/64K without any issues. 

aero
Obsidian | Level 7

I figured it out.  Apparently the source table was imposing a limit on the textx variable of 60 characters.  When I concatenated date_time to the values with seq=1 it would exceed 60char and drop the remaining characters before concatenating the next line.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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