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%3ESous-cha%C3%AEne%2C%20Munger%20ou...%20formule%26nbsp%3B%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%3EJe%20suis%20aux%20prises%20avec%20un%20probl%C3%A8me%20de%20base%20de%20donn%C3%A9es%20depuis%20quelques%20jours%20et%20je%20suis%20perplexe.Je%20me%20demande%20si%20l'un%20d'entre%20vous%20pourrait%20%C3%AAtre%20en%20mesure%20d'aider%3FJ'ai%20affaire%20%C3%A0%20plusieurs%20centaines%20de%20tables%20qui%20incluent%20des%20enregistrements%20de%20sites%20fauniques.%20Pour%20chaque%20enregistrement%2C%20il%20y%20a%20un%20champ%20qui%20inclut%20l'identifiant%20du%20site%20ajout%C3%A9%20au%20chemin%20dans%20mon%20ordinateur%20et%20un%20suffixe%20.tif%2C%20comme%20ces%20exemples%26nbsp%3B%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%5BIdentifiant%20du%20site%20en%20italique%20gras%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%3EJe%20dois%20cr%C3%A9er%20un%20nouveau%20champ%20dans%20chaque%20table%20contenant%20uniquement%20l'identifiant%20du%20site%2C%20moins%20le%20chemin%20et%20le%20suffixe%20.tif.Je%20connais%20un%20peu%20les%20formules%20de%20sous-cha%C3%AEne%20et%20de%20Munger%20que%20j'ai%20utilis%C3%A9es%20pour%20extraire%20des%20parties%20de%20cha%C3%AEnes.Mais%20dans%20ce%20cas%2C%20certains%20identifiants%20de%20site%20ont%20des%20caract%C3%A8res%20mixtes%20texte%2Fnum%C3%A9rique%20et%20la%20longueur%20de%20la%20cha%C3%AEne%20est%20diff%C3%A9rente%20entre%20les%20diff%C3%A9rents%20enregistrements%2C%20donc%20je%20ne%20peux%20pas%20faire%20fonctionner%20ces%20formules.Quelqu'un%20peut-il%20offrir%20des%20conseils%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