1 Reply Latest reply: Jan 11, 2017 12:04 PM by Zayd Derweesh RSS

    Nested IF statement looking for contents of a string to write to 2 variables

    Zayd Derweesh

      Hello friends,

       

      I have the following SAS code that which does the following:

      - Searches for a string in the variable area_office_trim

      - IF it finds the string, outputs numeric values to two fields: latitude and longitude

      - IF not, continues to the next part of the IF statement.

       

      I need to replicate this in QlikSense, but also since latitude and longitude go on a map I need to make sure QlikSense recognizes these are geographic. Also, do I need to create the variables latitude and longitude prior to this and add this as a preceding load? Or can they be created on the fly? area_office_trim has been loaded from an Excel document earlier.

       

       

      SAS code is below:

       

      IF  find(area_office_trim,'SEATTLE','i') ge 1 THEN

      DO;

        latitude = 47.59 ;

        longitude = -122.32;

      END;

      ELSE IF  find(area_office_trim,'LONDON','i') ge 1 THEN

      DO;

        latitude = 32.11 ;

        longitude = -110.98;

      END;

      ELSE IF  find(area_office_trim,'PARIS','i') ge 1 THEN

      DO;

        latitude = 39.06 ;

        longitude = -77.11;

      END;

       

       

       

      Thanks!