Hello,
I am using call scan to substring a variable to remove the last number from the string. I am receiving the Note: Invalid error to substring, although it seems to be working.
Have:
Want:
here is my code:
call scan(_egtpt, -1, pos, length) ;
egtpt= upcase(substr(_egtpt,1, pos-2));
LOG:
Any help with clearing the note would be appreciated. Thank you!
If your variable value has just 1 digit value as the last value, you don't need call scan
want=upcase(substr(k,1,length(k)-2));
Try
data w;
k='Pre-Dose 2';
/*call scan(k, -1, pos, length) ;*/
want=upcase(substr(k,1,length(k)-2));
run;
Thank you! there were a few missing values. Works great now!
If you copy code and/or error messages directly from your log you can paste the text into a codebox opened using the forum's {I} icon. Then edit anything you don't want to show such as XXXX for sensitive data. I think this may be easier than creating an image file, editing the image and the pasting the image in the forum.
Then we can also highlight or otherwise indicate directly in the text where a problem may be.
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!
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.