CSVtest.frink

Download or view CSVtest.frink in plain text format


use CSV.frink

data1 = """\"ID","VISIT","FORM_V","COMP_D","INITS","LOCATIO","PREGNAN0","ANTICOA0","ACOAMD10","ACOAYS10","ACOAYR10","ACOAMO10","ACOAVR10","ACOAMD20","ACOAYS20","ACOAYR20","ACOAMO20","ACOAVR20","HEART0","HARTMD10","HARTYS10","HARTYR10","HARTMO10","HARTVR10","HARTMD20","HARTYS20","HARTYR20","HARTMO20","HARTVR20","ULCER0","ULCRMD10","ULCRYS10","ULCRYR10","ULCRMO10","ULCRVR10","ULCRMD20","ULCRYS20","ULCRYR20","ULCRMO20","ULCRVR20","CHOLEST0","CHOLMD10","CHOLYS10","CHOLYR10","CHOLMO10","CHOLVR10","CHOLMD20","CHOLYS20","CHOLYR20","CHOLMO20","CHOLVR20","BP0","BPMED10","BPYS10","BPYR10","BPMO10","BPVR10","BPMED20","BPYS20","BPYR20","BPMO20","BPVR20","THYROID0","THYRMD10","THYRYS10","THYRYR10","THYRMO10","THYRVR10","THYRMD20","THYRYS20","THYRYR20","THYRMO20","THYRVR20","INSULIN0","INSUMD10","INSUYS10","INSUYR10","INSUMO10","INSUVR10","INSUMD20","INSUYS20","INSUYR20","INSUMO20","INSUVR20","NERVOUS0","NERVMD10","NERVYS10","NERVYR10","NERVMO10","NERVVR10","NERVMD20","NERVYS20","NERVYR20","NERVMO20","NERVVR20","STEROID0","STERMD10","STERYS10","STERYR10","STERMO10","STERVR10","STERMD20","STERYS20","STERYR20","STERMO20","STERVR20","INHALER0","INHAMD10","INHAYS10","INHAYR10","INHAMO10","INHAVR10","INHAMD20","INHAYS20","INHAYR20","INHAMO20","INHAVR20","HORMCRE0","HCRMMD10","HCRMYS10","HCRMYR10","HCRMMO10","HCRMVR10","HCRMMD20","HCRMYS20","HCRMYR20","HCRMMO20","HCRMVR20","HORMPIL0","HORMMD10","HORMYS10","HORMYR10","HORMMO10","HORMVR10","HORMMD20","HORMYS20","HORMYR20","HORMMO20","HORMVR20","ESTRPTC0","ESTRMD10","ESTRYS10","ESTRYR10","ESTRMO10","ESTRVR10","ESTRMD20","ESTRYS20","ESTRYR20","ESTRMO20","ESTRVR20","BCP0","BCPMED10","BCPYS10","BCPYR10","BCPMO10","BCPVR10","BCPMED20","BCPYS20","BCPYR20","BCPMO20","BCPVR20","OTHMED10","OTHRMD10","OTHRYS10","OTHRYR10","OTHRMO10","OTHRVR10","OTHMED20","OTHRMD20","OTHRYS20","OTHRYR20","OTHRMO20","OTHRVR20","OTHMED30","OTHRMD30","OTHRYS30","OTHRYR30","OTHRMO30","OTHRVR30","OTHMED40","OTHRMD40","OTHRYS40","OTHRYR40","OTHRMO40","OTHRVR40","PAIN0","PAINMD10","PAINYS10","PAINYR10","PAINMO10","PAINVR10","PAINMD20","PAINYS20","PAINYR20","PAINMO20","PAINVR20","SLEEP0","SLEPMD10","SLEPYS10","SLEPYR10","SLEPMO10","SLEPVR10","SLEPMD20","SLEPYS20","SLEPYR20","SLEPMO20","SLEPVR20","BOWEL0","BOWLMD10","BOWLYS10","BOWLYR10","BOWLMO10","BOWLVR10","BOWLMD20","BOWLYS20","BOWLYR20","BOWLMO20","BOWLVR20","HEARTBR0","HBRNMD10","HBRNYS10","HBRNYR10","HBRNMO10","HBRNVR10","HBRNMD20","HBRNYS20","HBRNYR20","HBRNMO20","HBRNVR20","OTHOTC10","OTCMD10","OTCYS10","OTCYR10","OTCMO10","OTCVR10","OTHOTC20","OTCMD20","OTCYS20","OTCYR20","OTCMO20","OTCVR20","OTHOTC30","OTCMD30","OTCYS30","OTCYR30","OTCMO30","OTCVR30","OTHOTC40","OTCMD40","OTCYS40","OTCYR40","OTCMO40","OTCVR40","INSUEVE0","INSUEVY0","INSUEVM0","THYREVE0","THYREVY0","THYREVM0","CORTEVE0","CORTEVY0","CORTEVM0","COAGEVE0","COAGEVY0","COAGEVM0","BARBEVE0","BARBEVY0","BARBEVM0","DIUREVE0","DIUREVY0","DIUREVM0","CONVEVE0","CONVEVY0","CONVEVM0","LITHEVE0","LITHEVY0","LITHEVM0","AMPHEVE0","AMPHEVY0","AMPHEVM0","PREMEVE0","PREMEVY0","PREMEVM0","PTCHEVE0","PTCHEVY0","PTCHEVM0","COMBEVE0","COMBEVY0","COMBEVM0","PROVEVE0","PROVEVY0","PROVEVM0","TAMOEVE0","TAMOEVY0","TAMOEVM0","DESEVER0","DESEVYR0","DESEVMO0","DEPOEVE0","DEPOEVY0","DEPOEVM0","FERTEVE0","FERTEVY0","FERTEVM0","BCEVER0","BCEVYR0","BCEVMO0","BCREAS0","STROKE0","STROKMD0","HBCHOLE0","HBCHOMD0","MIGRAIN0","MIGRAMD0","GALLSTO0","GALLSMD0","OSTEOAR0","OSTEOMD0","OATHYRO0","OATHYMD0","UATHYRO0","UATHYMD0","HBCALCI0","HBCALMD0","ANEMIA0","ANEMIMD0","LIVER0","LIVERMD0","EPILEPS0","EPILEMD0","PHLEBIT0","PHLEBMD0","ANOREXI0","ANOREMD0","BULIMIA0","BULIMMD0","TUBERCU0","TUBERMD0","AIDS0","AIDSMED0","LUPUS0","LUPUSMD0","LISTEN0","TAKETOM0","CONFIDE0","HELPSIC0","COMMITE0","DEGHAPP0","STARTAG0","FLOWDAY0","TENDAFL0","SPOTBET0","FLOWAMT0","FLOODIN0","CLOTS0","STARTDA0","USUALDA0","CRAMPS0","BREASTP0","BLOATED0","MOODCHN0","CRAVING0","ANXIOUS0","BACKPAI0","LESSSEX0","MORESEX0","INTERFE0","HEADACH0","CHARACT0","INTERVA0","BC25TO30","FLOAGE20","SPOT2530","FLOD2530","CLOT2530","STRT2530","NOPERIO0","BREASTF0","BFEVE0","NUMPREG0","OUTCM10","DELVR10","BFMO10","BFYR10","WTBFR10","LBGN10","KGGN10","WTAFT10","OUTCM20","DELVR20","BFMO20","BFYR20","WTBFR20","LBGN20","KGGN20","WTAFT20","OUTCM30","DELVR30","BFMO30","BFYR30","WTBFR30","LBGN30","KGGN30","WTAFT30","OUTCM40","DELVR40","BFMO40","BFYR40","WTBFR40","LBGN40","KGGN40","WTAFT40","OUTCM50","DELVR50","BFMO50","BFYR50","WTBFR50","LBGN50","KGGN50","WTAFT50","OUTCM60","DELVR60","BFMO60","BFYR60","WTBFR60","LBGN60","KGGN60","WTAFT60","OUTCM70","DELVR70","BFMO70","BFYR70","WTBFR70","LBGN70","KGGN70","WTAFT70","OUTCM80","DELVR80","BFMO80","BFYR80","WTBFR80","LBGN80","KGGN80","WTAFT80","OUTCM90","DELVR90","BFMO90","BFYR90","WTBFR90","LBGN90","KGGN90","WTAFT90","OUTCM100","DELVR100","BFMO100","BFYR100","WTBFR100","LBGN100","KGGN100","WTAFT100","AGFIRPR0","AGLASPR0","AGFIRKI0","AGLASKI0","NOGETPR0","WHYNOPR0","WHYSPEC0","TRYPREG0","HERBS0","HERBSPE0","BOTHER0","APPETIT0","BLUES0","GOOD0","KEEPMIN0","DEPRESS0","EFFORT0","HOPEFUL0","FAILURE0","FEARFUL0","RESTLES0","HAPPY0","TALKLES0","LONELY0","UNFRNDL0","ENJOY0","CRYING0","SAD0","DISLIKE0","GETGOIN0","HSWRKHR0","JOB0","DAYSHFT0","EVESHFT0","NGHTSHF0","ROTSHFT0","PHYSWOR0","SIT0","STAND0","WALK0","LIFT0","STOOP0","PUSH0","SWEAT0","LANGREA0","READSPE0","LANGTHN0","THNKSPE0","LANGSPE0","SPEKSPE0","LANGPRO0","PROGSPE0","HOUSEHL0","MALEPAR0","FEMPART0","MOTHER0","FATHER0","MOTINLA0","FATINLA0","DAUGHTE0","SON0","SISTER0","BROTHER0","OTHFEMA0","OTHRMAL0","LANGUAG0","SITE","FORMVER0","AGECONT0","AGE0","ACOAYT10","ACOAYT20","HARTYT10","HARTYT20","ULCRYT10","ULCRYT20","CHOLYT10","CHOLYT20","BPYT10","BPYT20","THYRYT10","THYRYT20","INSUYT10","INSUYT20","NERVYT10","NERVYT20","STERYT10","STERYT20","INHAYT10","INHAYT20","HCRMYT10","HCRMYT20","HORMYT10","HORMYT20","ESTRYT10","ESTRYT20","BCPYT10","BCPYT20","PAINYT10","PAINYT20","SLEPYT10","SLEPYT20","BOWLYT10","BOWLYT20","HBRNYT10","HBRNYT20","OTHRYT10","OTHRYT20","OTHRYT30","OTHRYT40","OTCYT10","OTCYT20","OTCYT30","OTCYT40","INSUEYT0","THYREYT0","CORTEYT0","COAGEYT0","BARBEYT0","DIUREYT0","CONVEYT0","LITHEYT0","AMPHEYT0","PREMEYT0","PTCHEYT0","COMBEYT0","PROVEYT0","TAMOEYT0","DESEYT0","DEPOEYT0","FERTEYT0","BCEYT0","BFYRT10","BFYRT20","BFYRT30","BFYRT40","BFYRT50","BFYRT60","BFYRT70","BFYRT80","BFYRT90","BFYRT100","SOCSUPP0","SUMCESD0","CESD0","LMPDATE0","CONTROL0","ABILITY0","YOURWAY0","PILING0","P_STRES0","START","STOP","CESMEAN0\""""

data2=""""1100016","00",13131.000000,13181.000000,"PAM",2.000000,1.000000,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,2.000000,"TOPROL",2.000000,3.000000,0.000000,2.000000,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,2.000000,"RELAFEN",2.000000,0.000000,10.000000,2.000000,1.000000,"!B!",,,,,,"!B!",,,,,,"!B!",,,,,2.000000,"TYLENOL",2.000000,0.000000,3.000000,1.000000,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,1.000000,"!B!",,,,,"!B!",,,,,2.000000,"MULTIVIT",2.000000,0.000000,6.000000,1.000000,1.000000,"!B!",,,,,,"!B!",,,,,,"!B!",,,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,2.000000,2.000000,0.000000,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,1.000000,,,2.000000,5.000000,0.000000,1.000000,1.000000,,1.000000,,2.000000,1.000000,2.000000,1.000000,2.000000,2.000000,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,1.000000,,2.000000,5.000000,1.000000,3.000000,2.000000,2.000000,12.000000,2.000000,1.000000,1.000000,2.000000,1.000000,2.000000,1.000000,3.000000,2.000000,2.000000,1.000000,2.000000,2.000000,2.000000,2.000000,2.000000,1.000000,2.000000,2.000000,,3.000000,1.000000,1.000000,1.000000,2.000000,1.000000,2.000000,3.000000,,,1.000000,1.000000,1.000000,0.000000,0.000000,1.000000,25.000000,11.33992561008800,1.000000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,22.000000,22.000000,22.000000,22.000000,1.000000,,"      -1",1.000000,,"      -1",3.000000,1.000000,3.000000,1.000000,2.000000,4.000000,3.000000,2.000000,3.000000,1.000000,4.000000,1.000000,3.000000,4.000000,2.000000,2.000000,3.000000,3.000000,2.000000,2.000000,3.000000,1.000000,,,,,,,,,,,,,1.000000,"!B!",1.000000,"!B!",1.000000,"!B!",1.000000,"!B!",1.000000,,,,,,,,,,,,,1.000000,"11",13131.000000,43.200000,43.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,3.000000,,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.250000,,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.83333333333333,0.000000,,,0.500000,0.000000,,,0.000000,0.000000,0.000000,0.000000,2.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,5.000000,0.000000,,,,,,,,,,7.000000,37.000000,1.000000,13149.000000,3.000000,1.000000,3.000000,3.000000,14.000000,29700.000000,34140.000000,1.850000"""

d1 = CSV.parseQuoted[data1]
d2 = CSV.parseQuoted[data2]

println[d1]
println[d2]

println[length[d1]]
println[length[d2]]

if length[d1] != length[d2]
   println["Column lengtth mismatch."]

// Test conversion of spreadsheet column names to indices.
for i = 0 to 1000000
   if i != CSV.ssColumnToIndex[CSV.ssIndexToColumn[i]]
      println["Error at column $i"]
   


Download or view CSVtest.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20218 days, 0 hours, 17 minutes ago.