BookmarkSubscribeRSS Feed
sf388
Calcite | Level 5
I asked for help from SAS tech support on a specific example of a COMPGED function application, but was only referred to the SAS documentation. I would appreciate it if someone familiar with the COMPGED function can give some insight into the following:

I have compared the following two text strings using this function:

COMPGED('F350SUPERDUTYDRWCREWCAB','F350SUPERDUTYCREWCAB172WB')

and the result is 620. I'm unable to figure out the operations that were used in determining this cost, and I have not changed the default costs. It seems to me that one way to construct string 1 from string 2 is to
1) truncate the last 5 characters (cost = 10*5 = 50)
2) insert the 3 characters DRW (cost = 100*3 = 300)
for a total cost of 350. Can someone explain why COMPGED returns 620?
2 REPLIES 2
sf388
Calcite | Level 5
Is it that the last 2 characters (WB) get "truncated" (10*2=20) and then the "172" gets "deleted" (100*3=300) because string2 is 2 characters longer than string1?
So, the cost of removing "172WB" is actually 320, not 50?
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
How about Google search the SAS.COM support site?

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:
+COMPGED +example site:sas.com

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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