Saturday, December 23, 2006

Parsing names using scan and substr functions

Most of the times the raw data is received which requires processing before analysis. Recently, I assisted a researcher in analyzing this school data which was in the following format. The names in (brackets) is the maiden name. We have to find the everyone's name before marriage among other things.

DATA dataset ;

INPUT obs 1 name $ 2-45 idno $ 46-58 state $ 59 ;

LENGTH obs 3 ;

cards;

6RED MURAR: DID NOT COMPLETE 09/2251/0018Â 2

7MARLA (WOHL) RANDH 08/3559/0074Â 3

8RED (KRAKAS) MOHLK 07/1452/0025Â 6

9MNIT K. RAJHU 02/1758/0069Â 1

; RUN ;

/*notice the patterns which will be used to identify different variables*/
data grit;
set dataset;
roll1= SCAN(idno,-1,'/');

roll= substr(roll1,1,4);

name1= SCAN(name,1,':');

first1= SCAN(name1,1,' ');
len_temp=indexc(name,'(');
if len_temp gt 0 then do;

last1=scan(name,-1,'(');

last2=scan(last1,1,')');
last3=compress(last2," ");
maiden=trim(first1)||" "||last3;
end;
if maiden=" " then maiden=trim(name1);
proc print;
var roll name1 first1 last3 maiden;

run;

/*Pitfalls detailed here */

/* A very useful program is available here */

49 comments:

Anonymous said...

Hello,

I mostly visits this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]You have really contiributed very good info here sasonunix.blogspot.com. I am sure due to busy scedules we really do not get time to care about our health. In plain english I must warn you that, you are not serious about your health. Recent Research points that about 50% of all U.S. adults are either chubby or overweight[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] So if you're one of these individuals, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss[/url] is not like piece of cake. You need to improve some of you daily habbits to achive weight loss in short span of time.

About me: I am writer of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also mentor who can help you lose weight quickly. If you do not want to go under hard training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effective weight loss.

Anonymous said...

I love sasonunix.blogspot.com! Here I always find a lot of helpful information for myself. Thanks you for your work.
Webmaster of http://loveepicentre.com and http://movieszone.eu
Best regards

Anonymous said...

http://www.purchaselevitranorx.com/#6sasonunix.blogspot.com - buy viagra [url=http://www.purchaselevitranorx.com/#4sasonunix.blogspot.com]levitra[/url] levitra
levitra

Anonymous said...

Keep on working, great job!
Here is my web-site ... africanmangoplusdirect.com

Anonymous said...

buy viagra with dapoxetine order viagra europe - generic viagra date

Anonymous said...

generic viagra buy generic viagra bangkok - buy viagra online overnight delivery

Anonymous said...

Oh my goodness! Impressive article dude! Many thanks, However I am encountering troubles with
your RSS. I don't know why I can't join it. Is there anyone else
getting the same RSS problems? Anyone who knows the answer will
you kindly respond? Thanx!!
Also visit my webpage ; Skin Care Online

Anonymous said...

I like looking through an article that can make people think.
Also, thank you for allowing me to comment!
Also see my web page > best Anti Wrinkle Cream

Anonymous said...

Hi there! This is my first comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading through
your articles. Can you recommend any other blogs/websites/forums that deal with
the same topics? Thanks for your time!
Also visit my blog post ... Buy Eprofit Academy

Anonymous said...

Hi, I do think this is an excellent blog. I stumbledupon it ;) I will come back yet again since i have bookmarked it.
Money and freedom is the best way to change, may you be rich and continue to
guide other people.
My web site - Equifax

Anonymous said...

Hey there just wanted to give you a quick heads up.

The words in your post seem to be running off the screen in Safari.
I'm not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I'd post to let you
know. The layout look great though! Hope you get the problem resolved soon.
Kudos
Take a look at my site ; Electronic Cigarettes

Anonymous said...

Today, I went to the beach with my children. I found a sea shell and
gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear."
She put the shell to her ear and screamed. There
was a hermit crab inside and it pinched her ear.
She never wants to go back! LoL I know this is totally
off topic but I had to tell someone!
Here is my webpage Garcinia Cambogia Extract

Anonymous said...

This text is invaluable. When can I find out more?
Also visit my webpage ; Buy Testoril

Anonymous said...

I could not resist commenting. Perfectly written!
Feel free to visit my blog - Buy Maximum 10

Anonymous said...

Today, I went to the beachfront with my children.

I found a sea shell and gave it to my 4 year old daughter and said
"You can hear the ocean if you put this to your ear." She put the shell to
her ear and screamed. There was a hermit crab inside and it pinched her
ear. She never wants to go back! LoL I know this is entirely
off topic but I had to tell someone!
Also see my webpage :: Remove Skin Tags

Anonymous said...

If some one desires expert view concerning running a blog afterward i
recommend him/her to pay a quick visit this web site, Keep up the
fastidious work.
Feel free to visit my homepage - Essence of Argan review

Anonymous said...

Hey I know this is off topic but I was wondering if you knew
of any widgets I could add to my blog that automatically tweet my newest twitter
updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.
Here is my blog post :: Premium Green Coffee

Anonymous said...

No matter if some one searches for his essential thing, thus he/she wants to
be available that in detail, thus that thing is maintained over here.
My web site: http://www.class-movement.com/MattiePax

Anonymous said...

viagra pills cheap brand viagra online - order real viagra online

Anonymous said...

soma for sale soma san diego minus the bear - soma online game

Anonymous said...

soma carisoprodol where to buy somat salt - soma san diego young the giant

Anonymous said...

buy tramadol cod next day delivery tramadol rx purchase - tramadol ketorolaco

Anonymous said...

buy tramadol online tramadol for dogs maximum dosage - tramadol 50mg norsk

Anonymous said...

tramadol 50 mg tramadol online canadian pharmacy - tramadol dosage in elderly

Anonymous said...

woodworking projects , http://woodworkingplans1.com/#MESESHIENDSAB woodworking projects

Anonymous said...

buy tramadol india tramadol withdrawal itching - order tramadol from usa

Anonymous said...

buy tramadol tramadol overdose 1000mg - par 822 tramadol

Anonymous said...

xanax online xanax effects next day - 1.5 mg xanax effects

Anonymous said...

tramadol without prescription buy tramadol 50mg net - buy tramadol online from usa

Anonymous said...

cheap cialis online cialis generico - cialis price philippines

Anonymous said...

cialis online cialis reviews comments - cialis price thailand

Anonymous said...

buy cialis online buy cheap cialis us - generic cialis united pharmacy

Anonymous said...

cheap cialis 20mg cialis 20 reviews - buy cialis online south africa

Anonymous said...

buy cialis online buy cialis no prescription - buy cialis online no prescription usa

Anonymous said...

buy real cialis online generic cialis cheap - where to buy cialis safely online

Anonymous said...

cialis online viagra cialis price difference - order cialis online us

Anonymous said...

http://landvoicelearning.com/#57594 tramadol withdrawal home remedies - tramadol street value 50 mg

Anonymous said...

learn how to buy tramdadol tramadol 1a pharma 50 mg - buy tramadol without rx

Anonymous said...

buy tramadol online tramadol buy online no prescription - buy tramadol usa next day delivery

Anonymous said...

http://buytramadolonlinecool.com/#61458 tramadol 50 mg white pill - tramadol hcl 75mg

Anonymous said...

learn how to buy tramdadol tramadol hcl capsules 50mg - tramadol 25mg

Anonymous said...

buy generic klonopin klonopin .5mg dosage - klonopin reviews

Anonymous said...

Hi, ativan medication - order ativan http://indiarss.net/, [url=http://indiarss.net/]ativan without prescription [/url]

Anonymous said...

Hi, cheap zyprexa online - cheap olanzapine http://www.onlinepharmdiscount.com/zyprexa/, [url=http://www.onlinepharmdiscount.com/zyprexa/]cheap generic zyprexa [/url]

Anonymous said...

4, [url=http://www.lunestasleepaid.net/]lunesta online [/url] - lunesta online pharmacy - lunesta pills http://www.lunestasleepaid.net/.

Anonymous said...

4, Maxalt For Sale - purchase maxalt online http://www.maxaltrxonline.net/, [url=http://www.maxaltrxonline.net/]Maxalt Online [/url]

Anonymous said...

Ηello, thiѕ weekend is fastidiοus deѕigneԁ fοr me, аs this ocсasiοn i am reading this
wondeгful informаtive piecе of writing heгe at my house.


Also visit mу web рage ... short hairstyles

Anonymous said...

Perineoplasty (or Perineorrhaphy) has an objective of making this area look normal by cutting out excess skin and flaccid skin tags.
Do this method up to four times a day until the skin tag falls
off. The brown-slatted background in the image above really isn't part of the technique I was trying to demonstrate here.

my blog; skin tags moles ()

Unknown said...

tommy hilfiger shoes
coach outlet
oakley sunglasses
adidas yeezy
adidas uk
ugg canada
steph curry shoes
gucci outlet
valentino
adidas yeezy
20170113