🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 06-05-2018 08:14 PM
(1791 views)
Hello,
I am trying to clean character strings - I would like to pull out and keep only the characters between the first set of quotes.
Here is an example:
{"I34.0":1,"I48.0
I would like the result to be
I34.0
Thank you!
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do you mean quotes. I don't see parentheses() in your string.
data test;
string='{"I34.0":1,"I48.0';
sub=scan(string,2,'"');
run;
Use scan function taking " as delimiter.
Thanks,
Suryakiran
Suryakiran
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do you mean quotes. I don't see parentheses() in your string.
data test;
string='{"I34.0":1,"I48.0';
sub=scan(string,2,'"');
run;
Use scan function taking " as delimiter.
Thanks,
Suryakiran
Suryakiran
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
yes thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Assuming you mean double quotes, not parentheses,
data have;
CharString = '{"I34.0":1,"I48.0';
output;
run;
data want;
retain _RX1;
if _n_ = 1 then
_RX1 = prxparse('|"([^"]+)"|');
set have;
if prxmatch(_RX1, CharString) then
WantedString = prxposn(_RX1, 1, CharString);
run;
Tom