finance - Modifying a list of ticker symbols in sas by deleting the last few characters -


i have long list of time-series price data sorted ticker symbol , date. i'm looking delete last 4 characters on every ticker. ticker aaa.asx, end aaa match , merge data set.

so far i've tried code:

asx=tranwrd(asx,".asx",""); put asx; run;

any advice appreciated i'm getting whole sas thing.

to expand upon joe's answer slightly, scan includes . 1 of it's standard delimiters , third argument not strictly necessary (but it's practice explicit).

data tmp;     asx = "abc.def";      /* return first word, when seperated . */      asx1 = scan(asx, 1, ".");     put asx1=;      /* return first word, when seperated standard delimiters _ -,."' etc. */      asx2 = scan(asx, 1);     put asx2=;      /* return first 3 characters (if know 3 long) */     asx3 = substr(asx, 1, 3);     put asx3=;      /* return substring position 1 first occourance of . */     asx4 = substr(asx, 1, index(asx, ".") - 1);     put asx4=; run; 

as learning sas may worth while check out of other string manipulation functions substr , index it's great have multiple tools available.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -