cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-8402%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ESubstring%2C%20Munger%20oder%20...%20Formel%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-8402%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CP%3EIch%20k%C3%A4mpfe%20seit%20ein%20paar%20Tagen%20mit%20einem%20Datenbankproblem%20und%20bin%20ratlos.Ich%20frage%20mich%2C%20ob%20jemand%20von%20euch%20vielleicht%20helfen%20kann%3FIch%20habe%20es%20mit%20mehreren%20hundert%20Tabellen%20zu%20tun%2C%20die%20Datens%C3%A4tze%20f%C3%BCr%20Wildtierstandorte%20enthalten.%20F%C3%BCr%20jeden%20Datensatz%20gibt%20es%20ein%20Feld%2C%20das%20die%20Standortkennung%20enth%C3%A4lt%2C%20die%20an%20den%20Pfad%20auf%20meinem%20Computer%20angeh%C3%A4ngt%20ist%2C%20und%20ein%20.tif-Suffix%2C%20wie%20in%20diesen%20Beispielen%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%22%3EE%3A%5CWork%5COWI%5CLIDAR%5COwl_Landscapes%5Cp99%5Cp99sliced%5Crnd_SI_PK_%3CEM%3E%3CSTRONG%3E%20UR3%3C%2FSTRONG%3E%3C%2FEM%3E%20.tif%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%22%3EE%3A%5CWork%5COWI%5CLIDAR%5COwl_Landscapes%5Cp99%5Cp99sliced%5Crnd_SI_PK_%3CEM%3E%3CSTRONG%3E%2020100195%3C%2FSTRONG%3E%3C%2FEM%3E%20.tif%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%5BStandortkennung%20fett%20und%20kursiv%5D%20%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%20color%3A%20black%3B%22%3EIch%20muss%20in%20jeder%20Tabelle%20ein%20neues%20Feld%20erstellen%2C%20das%20nur%20die%20Site-ID%20enth%C3%A4lt%2C%20abz%C3%BCglich%20des%20Pfads%20und%20des%20.tif-Suffixes.Ich%20bin%20etwas%20vertraut%20mit%20Substring-%20und%20Munger-Formeln%2C%20die%20ich%20verwendet%20habe%2C%20um%20Teile%20von%20Strings%20zu%20extrahieren.Aber%20in%20diesem%20Fall%20haben%20einige%20Site-IDs%20gemischte%20Text-%2FZahlenzeichen%20und%20die%20Zeichenfolgenl%C3%A4nge%20ist%20bei%20verschiedenen%20Datens%C3%A4tzen%20unterschiedlich%2C%20sodass%20ich%20diese%20Formeln%20nicht%20zum%20Laufen%20bringen%20kann.Kann%20jemand%20Rat%20geben%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%20color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2011.0pt%3B%20font-family%3A%20'Calibri'%2C'sans-serif'%3B%20color%3A%20black%3B%22%3EDavid%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
owiuser
Level I

Substring, Munger, or... formula?

I’ve been wrestling with a database problem for a couple of days and I’m stumped.  I wonder if any of you might be able to help?  I’m dealing with several hundred tables that include records for wildlife sites  For each record, there is a field that includes the site identifier appended to the path in my computer and a .tif suffix, like these examples:

E:\Work\OWI\LIDAR\Owl_Landscapes\p99\p99sliced\rnd_SI_PK_UR3.tif

E:\Work\OWI\LIDAR\Owl_Landscapes\p99\p99sliced\rnd_SI_PK_20100195.tif


[Site identifier in bold italics]

I need to create a new field in each table that holds only the site identifier, minus the path and .tif suffix.  I’m somewhat familiar with substring and Munger formulas that I have used to extract parts of strings.  But in this case, some site identifiers have mixed text/numeric characters and the string length is different among different records, so I can’t get these formulas to work.  Can someone offer advice?


Dave

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: Substring, Munger, or... formula?

Hi Dave,

Try the Word() function.

     Word( -2, :Column 1, "_." )

That formula will get you what you want. The "-2" argument says that the Word() function should find the second to last word using _ and . as delimiters.

-Jeff

-Jeff

View solution in original post

5 REPLIES 5
rw9
rw9
Level I

Re: Substring, Munger, or... formula?

Hi,

Check out perl regular expressions - base SAS = prxparse, prxchange etc.  Should be able to do this straightforward with that.

Just to add, it looks like you have a fixed start?  If so then tranwrd(substr(string,fixed_start),".tif","") should also work.

reeza
Level III

Re: Substring, Munger, or... formula?

I don't think standard SAS functions work in JMP.

Substring is what you're looking for.

The starting point is fixed, find the location of the period and substring between those. 

Re: Substring, Munger, or... formula?

Are you using JMP or Base SAS to read these files?

Jeff_Perkinson
Community Manager Community Manager

Re: Substring, Munger, or... formula?

Hi Dave,

Try the Word() function.

     Word( -2, :Column 1, "_." )

That formula will get you what you want. The "-2" argument says that the Word() function should find the second to last word using _ and . as delimiters.

-Jeff

-Jeff
owiuser
Level I

Re: Substring, Munger, or... formula?

Thank you everybody! Jeff's suggestion worked perfectly.  Dave

Recommended Articles