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

Hi everyone, 

I am reading several XML files as flat-files ... Imagine now i have a dataset XML3, with two columns:

xmlname (e.g.: XML_number1.xml), text1(several hundret alphanumeric characters, this is the xml-content). 

 

DATA xml4_codesys(KEEP = xmlname codesys_flg);
      SET xml3;
      FORMAT codesys_flg best8.;
      codesys_string = INDEX(text1, %str(<name code="2" codeSystem="2.16.840.1.113883.3.989.5.1.1.5.1" codeSystemVersion="1.0" displayName="Master"/>));
        IF codesys_string NE 0 THEN DO;
          codesys_flg = 1;
        END;
        ELSE DO;
          codesys_flg = 0;
        RUN;
    RUN;

First attempt with the %str() masking did not help unfortunately 😞

The string i want to search for is exactly this one:

<name code="2" codeSystem="2.16.840.1.113883.3.989.5.1.1.5.1" codeSystemVersion="1.0" displayName="Master"/>

Does someone has an easy solution without complex PERL-Reg-Expressions? 🙂

 

Thank you in advance for any idea, 

Felix

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Try to change the %str with single quotes :

codesys_string = INDEX(text1, '<name code="2" codeSystem="2.16.840.1.113883.3.989.5.1.1.5.1" codeSystemVersion="1.0" displayName="Master"/>');

View solution in original post

2 REPLIES 2
Shmuel
Garnet | Level 18

Try to change the %str with single quotes :

codesys_string = INDEX(text1, '<name code="2" codeSystem="2.16.840.1.113883.3.989.5.1.1.5.1" codeSystemVersion="1.0" displayName="Master"/>');
Felix_
Obsidian | Level 7

Sometimes, Solutions can be so easy 😄 Thank you 'Shmuel' !

 

... and sometimes you should Close the day after 10+ hours xD

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 875 views
  • 0 likes
  • 2 in conversation