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%3E%E5%AD%90%E4%B8%B2%E3%80%81%E8%8A%92%E6%A0%BC%EF%BC%8C%E9%82%84%E6%98%AF%E2%80%A6%E2%80%A6%E5%85%AC%E5%BC%8F%EF%BC%9F%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%3E%E5%B9%BE%E5%A4%A9%E4%BE%86%E6%88%91%E4%B8%80%E7%9B%B4%E5%9C%A8%E5%8A%AA%E5%8A%9B%E8%A7%A3%E6%B1%BA%E6%95%B8%E6%93%9A%E5%BA%AB%E5%95%8F%E9%A1%8C%EF%BC%8C%E4%BD%86%E6%88%91%E5%BE%88%E9%9B%A3%E9%81%8E%E3%80%82%E6%88%91%E6%83%B3%E7%9F%A5%E9%81%93%E4%BD%A0%E5%80%91%E4%B8%AD%E6%98%AF%E5%90%A6%E6%9C%89%E4%BA%BA%E5%8F%AF%E4%BB%A5%E6%8F%90%E4%BE%9B%E5%B9%AB%E5%8A%A9%EF%BC%9F%E6%88%91%E6%AD%A3%E5%9C%A8%E8%99%95%E7%90%86%E6%95%B8%E7%99%BE%E5%80%8B%E5%8C%85%E5%90%AB%E9%87%8E%E7%94%9F%E5%8B%95%E7%89%A9%E9%81%BA%E5%9D%80%E8%A8%98%E9%8C%84%E7%9A%84%E8%A1%A8%E6%A0%BC%E5%B0%8D%E6%96%BC%E6%AF%8F%E6%A2%9D%E8%A8%98%E9%8C%84%EF%BC%8C%E9%83%BD%E6%9C%89%E4%B8%80%E5%80%8B%E5%AD%97%E6%AE%B5%E5%8C%85%E5%90%AB%E9%99%84%E5%8A%A0%E5%88%B0%E6%88%91%E8%A8%88%E7%AE%97%E6%A9%9F%E8%B7%AF%E5%BE%91%E7%9A%84%E7%AB%99%E9%BB%9E%E6%A8%99%E8%AD%98%E7%AC%A6%E5%92%8C%E4%B8%80%E5%80%8B%20.tif%20%E5%BE%8C%E7%B6%B4%EF%BC%8C%E5%A6%82%E4%B8%8B%E4%BE%8B%E6%89%80%E7%A4%BA%EF%BC%9A%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%5B%E4%BB%A5%E7%B2%97%E6%96%9C%E9%AB%94%E9%A1%AF%E7%A4%BA%E7%9A%84%E7%AB%99%E9%BB%9E%E6%A8%99%E8%AD%98%E7%AC%A6%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%3E%E6%88%91%E9%9C%80%E8%A6%81%E5%9C%A8%E6%AF%8F%E5%80%8B%E8%A1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CSPAN%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%3E%E6%88%B4%E5%A4%AB%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