BookmarkSubscribeRSS Feed
juanvg1972
Pyrite | Level 9

Hi,

I have a problem with indexw function. I don't know what, but this code desont' worl properly:

data ruta;

ruta = "O:\_Privada\JVidal\Proyecto base\proyecto base.egp";

run;

data ruta_1;

set ruta;

nomfich=scan(ruta,-1,'\');

pos1 = indexw(ruta, nomfich);

pos2 = indexw(ruta, 'proyecto');

run;

The result is:

indexw.png

Can anybody help me?

Thanks in advance

http://sasybi.blogspot.com

1 REPLY 1
ballardw
Super User

In the future please describe how "it doesn't work", unexpected output and the expected result, no output or error messages.

With that, is this what you may have been looking for:

data work.ruta_1;

ruta = "O:\_Privada\JVidal\Proyecto base\proyecto base.egp";

nomfich=scan(ruta,-1,'\');

pos1 = indexw(ruta,strip(nomfich),'\.');

pos2 = indexw(ruta, 'proyecto','\ ');

run;

pos1 = indexw(ruta,strip(nomfich),'\.'); Needs to have blanks removed. If you look at the properties of the variable NOMFICH you will see that it is 200 characters long. The blanks at the end are included in comparisons unless removed for the operation. ALSO you need to provide information that \ is a word boundary character.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 669 views
  • 0 likes
  • 2 in conversation