Category: SAS

The blog has changed

I changed the name and the description of the blog. Why? Because I am no longer entrenched in just SAS. It is one part of the world I world I work in. Also, I don’t have a lot of hits and I use the blog mainly as a means of documenting technical discov…

SAS Certification sets up Indiana University grads for success

A year ago, Love Bisht and Hardi Gokani were working toward their master’s degrees in information systems at Indiana University’s Kelley School of Business when SAS piqued their interest. Today, they’re newly minted graduates with a powerful extra credential – SAS Certification. Love and Hardi, both India natives, encountered SAS […]

The post SAS Certification sets up Indiana University grads for success appeared first on The SAS Training Post.

Mapping the 50 US hospitals with the highest price markups

A recent study by Bai & Anderson has found that some hospitals charge 10x (ie, 1000%) higher than the standard rates set by Medicare. Many news agencies have posted the list of the 50 US hospitals that have the highest markup. But I am more visually oriented, so of course I used SAS […]

The post Mapping the 50 US hospitals with the highest price markups appeared first on The SAS Training Post.

Ask the Expert: Creating custom tasks for SAS Enterprise Guide

If you have not yet discovered the new Ask the Expert series on the SAS Training site, you are missing out on a treasure. Visit the site right now and review all of the available topics, from “Newbie” to Analytics to Visualization to good ol’ SAS programming. Go on; I’ll […]

The post Ask the Expert: Creating custom tasks for SAS Enterprise Guide appeared first on The SAS Dummy.

Tracking West Nile virus mosquitos in the US

Have you ever been bitten by a mosquito? What are the odds it carried the West Nile virus? … Perhaps a lot higher than you thought! Here’s a picture of a mosquito that kept ‘bugging’ me around my computer desk at home – good riddance, I say! The West Nile […]

The post Tracking West Nile virus mosquitos in the US appeared first on The SAS Training Post.

Indian Baby Population in US by State

Folks, I was going thru few visualizations on Tableau’s website today and I came across this visualization Exploring the SSA Baby Names Dataset by one of the acclaimed Tableau professional….It made me thinking to explore of How many of those SSA baby names are of Indian American (Desi) descent…

I found a website online that had a list of popular Indian baby names…I read the data into SAS and made a Tableau Story out of it… Please take a few moments to play with this interesting viz…I hope you like it….

Exploring Indian Baby Names from SSA Data

Here’s the SAS code that went into the prep of the data…

/*Read Indian Baby Names by parsing the http URL */

libnamesharad “C:UsersSharadDesktopnamesbystate”;

%macroloop(type);

proc sql; drop table name; quit;

%doi=1 %to 60;

filename foo url

    “http://www.modernindianbabynames.com/modern_baby_name/starting_with/ANY/MF/Sikh/1560/&i.”;

      

data _null;

retain start recind recst recend hier;

length SN Name Meaning Gender Origin $ 100;

retain SN Name Meaning Gender Origin;

   infile foo length=len;

   input record $varying200.len;

   put record $varying200.len;

   if index(record,) then start=1;

   if index(record,

) then start=0;

   if index(record,) then delete;

   if index(record,

) then do; recvalst=1; hier+1;; end;

   if index(record,

) then do; recvalend=1; delete; end;

   if index(record,‘ ‘ ) then do; recst=1; hier=0;delete; end;

   if index(record,

) then do; recst=0; hier=0;; end;

  

      if hier=1then do; record=tranwrd(record,

,); SN=strip(record); end;

      else if hier=2then do; record=tranwrd(record,

,); Name=strip(record); end;

      else if hier=3then do; record=tranwrd(record,

,); Meaning=strip(record); end;

      else if hier=4then do; record=tranwrd(record,

,); Gender=strip(record); end;

      else if hier=5then do; record=tranwrd(record,

,); Origin=strip(record); end;

      record=tranwrd(record,

,);

      record=tranwrd(record,

,);

      record=strip(record);

   if index(record,

) and start then do; recend=1; hier=0; output; end;

   else delete;  

   keep SN Name Meaning Gender Origin;

run;

OPTION SPOOL;

proc append data=_null base=sharad.&type force; run;

%end;

%mendloop;

%loop(Hindi);

/*

Make a list of Indian Names that definetly sound Indian or Closely Indian

Y – Yes

P – Indian Possibility

*/

dataSharad.Def_IndiaNames;

infilecards4 dlm=’09’xmissover;

lengthName $ 100 IndianorNot $ 1;

inputName IndianorNot;

Name=strip(propcase(Name));

cards;

Name  Indian

Tina  P

Tanya P

Maya  P

Trisha      Y

Nadia P

Amir  P

Aisha P

Tanisha     P

Chandra     P

Chaya P

Rohan Y

—-and 1000’s of other records—

;

run;

/*

Join all available Indian Names

*/

dataSharad.ALLNames;

setSharad.telugu

 sharad.bengali sharad.hindi sharad.sikh;

 Name=translate(Name,,“‘”);

 ifcompress(Name)= thendelete;

 dropSNO SN;

run;

/*

Remove Dups

*/

procsort data=Sharad.ALLNames noduprecsby Name; run;

/*

Re-purpose the data a bit

*/

dataSharad.IndianNames(rename=(dMeaning=Meaning dGender=IGender dOrigin=Origin));

lengthdMeaning $ 100 dGender $15dOrigin $ 100;

retaindMeaning dGender dOrigin;

setSharad.ALLNames;

byName;

if  first.name then

do;

dMeaning=;

dOrigin=;

dGender=;

end;

ifindex(strip(dMeaning),strip(Meaning)) eq 0then  dMeaning=catx(‘ OR ‘,strip(dMeaning),strip(Meaning));

ifindex(strip(dOrigin),strip(Origin)) eq 0then  dOrigin=catx(‘ ,’,strip(dOrigin),strip(Origin));;

ifindex(strip(dGender),strip(Gender)) eq 0then  dGender=catx(‘ OR ‘,strip(dGender),strip(Gender));;

ifdGender in (“Boy OR Girl”,“Girl OR Boy”) thendGender=“Boy OR Girl”;

dGender=strip(dGender);

if  last.name thenoutput;

keepName dMeaning dGender dOrigin;

run;

/*

Read US Gov SSA Baby Names data fields

*/

filenameallst “C:UsersSharadDesktopnamesbystateallallstates.txt”;

dataSharad.USNames;

infileallst dlm=‘,’dsd missoverfirstobs=2;

lengthState $ 2 Gender $1Year $4 Name $ 50;

inputState Gender Year Name Occurences;

run;

/*

Merge US Gov SSA Baby Names data with Indian Names Data

*/

procsql;

createtable sharad.IndNames as

selectA.*,IGender,Meaning,Origin

fromSharad.USNames A

leftjoin Sharad.IndianNames B

onA.name=B.name

orderby A.name;

quit;

/*

Merge US Gov SSA Baby Names data with Hand picked Indian Data

*/

procsql;

createtable sharad.DefinitelyIndian as

selectA.*,

case

whenA.name=B.name and IndianorNot=‘Y’then ‘Indian Name’

whenA.name=B.name and IndianorNot=‘P’then ‘Likely an Indian Name’

else‘Non-Indian Name’

endas IndianDescent length=10

fromsharad.IndNames A

leftjoin Sharad.Def_IndiaNames B

onA.name=B.name

;

quit;

DATA STEP text file tricks

When reading a text file (common extensions: TXT, DAT; or, for the adventurous: HTML) with the DATA STEP, you should always view several lines from the text file, and compare to the record layout, before completing the INPUT statement.  There are many ways to view a text file.  I use […]

The post DATA STEP text file tricks appeared first on The SAS Training Post.