Correct INFILE & INPUT options to read data file

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

Correct INFILE & INPUT options to read data file

[ Edited ]

Colleagues,

 

I do not fully understand what is necessary to read the attach file.  Please advise.  Program Summary and data in zip file attached

 

data osterodata;
infile'/folders/myfolders/AllClinical111.txt' dlm='|' truncover DSD end=eof;
input ID VERSION $ V11SF1 V11KPNR12 V11KPNR12M V11KPACT30 V11WPRKN1 V11WPRKN2
V11WPRKN3 V11WPRKN4 V11WPRKN5 V11KPRKN1 V11KPRKN2 V11KPRKN3 V11P7RKFR
V11WSRKN1 V11WSRKN2 V11KSXRKN1 V11KSXRKN2 V11KSXRKN3 V11KSXRKN4 V11KSXRKN5
V11DIRKN1 V11DIRKN2 V11DIRKN3 V11DIRKN4 V11DIRKN5 V11DIRKN6 V11DIRKN7
V11DIRKN8 V11DIRKN9 V11DIRKN10 V11DIRKN11 V11DIRKN12 V11DIRKN13 V11DIRKN14
V11DIRKN15 V11DIRKN16 V11DIRKN17 V11WPLKN1 V11WPLKN2 V11WPLKN3 V11WPLKN4
V11WPLKN5 V11KPLKN1 V11KPLKN2 V11KPLKN3 V11P7LKFR V11WSLKN1 V11WSLKN2
V11KSXLKN1 V11KSXLKN2 V11KSXLKN3 V11KSXLKN4 V11KSXLKN5 V11DILKN1 V11DILKN2
V11DILKN3 V11DILKN4 V11DILKN5 V11DILKN6 V11DILKN7 V11DILKN8 V11DILKN9
V11DILKN10 V11DILKN11 V11DILKN12 V11DILKN13 V11DILKN14 V11DILKN15 V11DILKN16
V11DILKN17 V11KOOSFX1 V11KOOSFX2 V11KOOSFX3 V11KOOSFX4 V11KOOSFX5 V11KQOL1
V11KQOL2 V11KQOL3 V11KQOL4 V11KGLRS V11HPNR12 V11HPNRIL V11HPNROL V11HPNRFL
V11HPNRB V11HPNRLB V11HPNRDK V11HPNL12 V11HPNLIL V11HPNLOL V11HPNLFL V11HPNLB
V11HPNLLB V11HPNLDK V11WOMTSL V11LKSX V11KPA30CV V11KPL12CV V11RKP30CV
V11KPACDCV V11WOMSTFL V11PMLKRCV V11KOOSYML V11HPR12CV V11KOOSKPL V11KOOSFSR
V11P7LKRCV V11RKSX V11WOMSTFR V11KOOSYMR V11KOOSKPR V11WOMKPR V11KOOSQOL
V11KPR30CV V11WOMADLR V11HPL12CV V11KPR12CV V11WOMTSR V11KPACTCV V11WOMKPL
V11LKP30CV V11PMRKRCV V11WOMADLL V11P7RKRCV V11KPL30CV V11P7RKACV V11KSX
V11P7LKACV V11KGWAY V11SF12GH V11ARTH12 V11ARTDOC V11KPMED V11INJR12
V11KSRGR12 V11KRSR12 V11ARTR12 V11AINJR12 V11MENR12 V11MINJR12 V11INJL12
V11KSRGL12 V11KRSL12 V11ARTL12 V11AINJL12 V11MENL12 V11MINJL12 V11HRS12
V11TYLEN V11NSAIDS V11NSAIDRX V11COXIBS V11NARCOT mmddyy10. V11SAME V11MSM V11DOXYCYC
V11PNMEDT V11CHON V11GLUC V11KNINJ V11HYALKN V11STERKN V11BISPHOS V11BISPYRS
V11BISPUSE V11STRINJR V11HYAINJL V11STINJCV V11OTA12CV V11OAH12CV V11HYAINJR
V11OAO12CV V11STRINJL V11OAF12CV V11HYINJCV V11GLCFQCV V11CHNFQCV V11OAD12CV
V11KPMEDCV V11OAB12CV V11BISPTYP V11ARTDRCV V11GT12CV V11SREPHR V11REASON
V11AGE V11VISITYP V11VISDYS V11RELY1 V11ASSIST V11FVDATE;
run;

proc print data=osterodata;
run;

Attachment

Accepted Solutions
Solution
‎03-31-2016 10:02 AM
Super User
Posts: 19,059

Re: Correct INFILE & INPUT options to read data file

You don't have a data specification document?

View solution in original post


All Replies
Respected Advisor
Posts: 3,786

Re: Correct INFILE & INPUT options to read data file

You need a colon format modifier.   May be others I did not notice .  This switch to formatted input gets you data out of sync. 

 

 

V11NARCOT mmddyy10.

V11NARCOT : mmddyy10.

 

Super User
Posts: 5,360

Re: Correct INFILE & INPUT options to read data file

Well, I'm not going to count field by field, but ... it looks like you have either (a) two fields missing from the data, or (b) two extra variables mentioned in the INPUT statement.  The notes complain about invalid data for V11RELY1 because of the date value in the data.  But the date is the last piece of information on the data line, and there are two more fields mentioned on the INPUT statement.  Basically we know that the data at the end of the line doesn't match the final variables in the INPUT statement.  This makes the entire INPUT statement suspect ... the error could be early in the INPUT statement rather than at the end.  You need to examine just one line of data.  Confirm that the data is reliable, and confirm that the documentation on it is also reliable (what fields should appear where on the line).  Then match that to the INPUT statement.

 

Secondarily, it seems wrong to apply a date informat to read V11NARCOT, and not to reading V11FVDATE.

Solution
‎03-31-2016 10:02 AM
Super User
Posts: 19,059

Re: Correct INFILE & INPUT options to read data file

You don't have a data specification document?

Occasional Contributor
Posts: 19

Re: Correct INFILE & INPUT options to read data file

Actually i did go and locate the variable guide. Thanks. I also used the proc import to understand my data and then map the correct informat and format statements. Data is looking good. Thank you Reeza
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 326 views
  • 1 like
  • 4 in conversation