- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am asked to subtract the numeric portion of a character variable using input(), substrn() or scan().
Thank you in advance for your help!
This is what the original character look like.
This is the expected result.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How do those align? How does 10.5[1] become 15.7 or is that just a generic example?
If you're just trying to remove the [1] section, use SCAN and INPUT.
num_var = input(scan(char_var, 1, "[]"), best32.);
@RebeccaJW wrote:
Hello,
I am asked to subtract the numeric portion of a character variable using input(), substrn() or scan().
Thank you in advance for your help!
This is what the original character look like.
This is the expected result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Subtract them from what?
Show your actual data, not photographs of your data.
Show what you have tried.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How do those align? How does 10.5[1] become 15.7 or is that just a generic example?
If you're just trying to remove the [1] section, use SCAN and INPUT.
num_var = input(scan(char_var, 1, "[]"), best32.);
@RebeccaJW wrote:
Hello,
I am asked to subtract the numeric portion of a character variable using input(), substrn() or scan().
Thank you in advance for your help!
This is what the original character look like.
This is the expected result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content