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

 

 

I am trying to take a period out of variable that looks like this: 03.17. My desired output would look like this: 0317. 

 

I am getting the following error message. 

 

"WARNING: In a call to the CAT function, the buffer allocated for the result was not long enough to contain the concatenation of all 

         the arguments. The correct result would contain 120 characters, but the actual result might either be truncated to 4 

         character(s) or be completely blank, depending on the calling environment. The following note indicates the left-most 

         argument that caused truncation.

NOTE: Argument 1 to function CAT at line 30 column 12 is invalid."

 

What I am doing wrong?

 

data work.claims;

set work.claims;

length specialty $4

first=substr(DZP_DBC_SPECIALISME,1,2);

second=substr(DZP_DBC_SPECIALISME,4,2);

specialty=cat(first,second);

drop first;

drop second; 

run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
specialty = compress(DZP_DBC_SPECIALISME,'.');
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26
specialty = compress(DZP_DBC_SPECIALISME,'.');
--
Paige Miller
Astounding
PROC Star

A few minor issues.

 

First, the length of FIRST and SECOND is not $2.  Rather, they have the same length as DZP_DBC_SPECIALISME. 

 

Second, the CAT function does not remove leading and trailing blanks (although CATS would do that).

 

So that's why the incoming strings won't fit into 4 characters.

 

Superseding all of this, why not just use the simple method:

 

specialty = compress(DZP_DBC_SPECIALISME, '.');

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2389 views
  • 1 like
  • 3 in conversation