DATA Step, Macro, Functions and more

cannot import this csv using proc import

Reply
Contributor
Posts: 39

cannot import this csv using proc import

Dear SAS community

I am using this proc import line to import this csv but keep getting this error below, can you help ?  many thanks 

 

 

 

PROC IMPORT Out=work.mrirest1 DATAFILE= "\\.psf\home\Documents\IronKey\CMRCOOP_merge\1CMR_COOP\data_csv\1_resting_mris.csv" DBMS=csv REPLACE; GETNAMES=YES; RUN;

 

 

NOTE: The infile

      '\\.psf\home\Documents\IronKey\CMRCOOP_merge\1CMR_COOP\data_csv\1_resting_mris.csv' is:

      Filename=\\.psf\home\Documents\IronKey\CMRCOOP_merge\1CMR_COOP\data_csv\1_resting_mris.csv,

      RECFM=V,LRECL=32767,File Size (bytes)=4493120,

      Last Modified=17Jun2016:10:20:26,

      Create Time=17Jun2016:10:20:26

 

NOTE: Invalid data for id in line 689 1-29.

NOTE: Invalid data for lvedvi in line 689 36-55.

NOTE: Invalid data for lvesvi in line 689 58-62.

NOTE: Invalid data for rvedvi in line 689 163-178.

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--

689            septum demonstrates myo",,"",,moderately decreased,,small,"",101.12,47.88,76.71,36

      88  .32,,,,24.41,24.14,,,,,,,31.0,,,,,,,,,37.0,,,,,1590,1,severely decreased,,,severely dil

     175  ated,,,,,,,,,,,,,,,,,,,,,,,0.0,0.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

     262  ,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 290

id=. study_id=. la_size=  lvedv=. lvedvi=. lvesv=. lvesvi=. epilvedv=  epilvedvi=1 lvmass_cal=4

lvsv=76.71 hr_rest=36.32 lvef=. sbp_rest=. lvef_vis=  dbp_rest=24.41 as=24.14 pl=. lvedd1=.

lvesd1=. lvedl=  lvesl=  lvmass=. lvmassi=31 co=. coi=. wma_rest=. perfdef_rest=. mde=.

delay_rv=. wma_rest_des=  perfdef_rest_des=  mde_atypical=37.0 delay_des=  stress_perf=.

stress_perf_des=  delay_vol=. rv_global=1590 rv_regional=1 rv_size=severe ra_size=  rvedv=.

rvedvi=. rvesv=. rvesvi=. epirvedv=  epirvedvi=  rvmass_cal=  rvsv=. rvef=. rvedd1=  rvesd1=

rvedl=  rvesl=  rvmass=  rvmassi=  ao_root_dimen=. ascending_aorta=  aortic_arch=

descending_aorta=  pa_diam=. right_pa=  left_pa=  old_lad_ap=. old_lad_tran=  old_lad_long=0

old_rad_ap=0 old_rad_tran=0 old_rad_long=  created_by_id=  updated_by_id=. site_id=. lv_global=

lvedd1i=  lvesd1i=  lv_size=  rest_perf_seg=  rvef_vis=  t2_star=  t_star_liver=  lad_3ch=.

rad_4ch=  radi_4ch=  lal_2ch_sys=  lal_2ch_pre=  lal_2ch_dia=  lal_4ch_sys=  lal_4ch_pre=

lal_4ch_dia=  laa_2ch_sys=  laa_2ch_pre=  laa_2ch_dia=  laa_4ch_sys=  laa_4ch_pre=  laa_4ch_dia=

lav_sys=  lav_pre=  lav_dia=  lavi_sys=. lavi_pre=. lavi_dia=. laefpassive=  laefactive=

laeftotal=  ladi_3ch=. lv_hypertrophy=  rv_hypertrophy=  la_other=  ra_other=  aorta=

lves_mass=  lves_massi=  wallthk_max=  lvedd2=  lvesd2=  lvedd2i=  lvesd2i=  lvsvi=  lvedli=

lvesli=  lvmass_cali=  fr_short=  lv_aver_mass=  lv_aver_massi=  slice_thn=  skip=  corrected=

lvedv_c=  lvesv_c=  lvsv_c=  lvef_c=  co_c=  lvmass_c=  lves_mass_c=  lv_aver_mass_c=  lvedd1_c=

lvesd1_c=  lvedd2_c=  lvesd2_c=  epilvedv_c=  lvmass_cal_c=  lvedl_c=  lvesl_c=  rvedd1i=

rvesd1i=  rvedd2=  rvesd2=  rvedd2i=  rvesd2i=  rvsvi=  rvedli=  rvesli=  rvmass_cali=  rvedv_c=

rvesv_c=  rvsv_c=  rvef_c=  rvmass_c=  rvedd1_c=  rvesd1_c=  rvedd2_c=  rvesd2_c=  epirvedv_c=

rvmass_cal_c=  rvedl_c=  rvesl_c=  rv_wallthk=  rv_ed_area=  rv_ed_areai=  rv_es_area=

rv_es_areai=  ra_area=  lv_other=  rv_other=  lv_no_cine=  lv_no_quant=  rv_no_cine=

rv_no_quant=  aorta_comments=  _ERROR_=1 _N_=688

NOTE: 10953 records were read from the infile

      '\\.psf\home\Documents\IronKey\CMRCOOP_merge\1CMR_COOP\data_csv\1_resting_mris.csv'.

      The minimum record length was 175.

      The maximum record length was 788.

NOTE: The data set WORK.MRIREST1 has 10953 observations and 179 variables.

NOTE: DATA statement used (Total process time):

      real time           0.35 seconds

      cpu time            0.34 seconds

 

 

Errors detected in submitted DATA step. Examine log.

10953 rows created in WORK.MRIREST1 from

\\.psf\home\Documents\IronKey\CMRCOOP_merge\1CMR_COOP\data_csv\1_resting_mris.csv.

 

 

 

ERROR: Import unsuccessful.  See SAS Log for details.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE IMPORT used (Total process time):

      real time           1.54 seconds

      cpu time            1.37 seconds

 

Super User
Posts: 19,877

Re: cannot import this csv using proc import

Hi Raymond, 

 

It's likely SAS isn't reading the correct type for the variable. 

You can try setting GUESSINGROWS=32000 or the number of records in your file so that it scans the full table before assigning a variable type.

 

Another option - which I generally recommend - is to look at your log after the PROC IMPORT. The Log has the import code, but in a data step format. If you copy that code, holding down CTRL+ALT while selecting to avoid line numbers, you can customize it to your needs. Specifically, check the informat/format and input statement for the variables that are causing errors in your log.

 

It looks like you have four specific variables causing the errors:

 

NOTE: Invalid data for id in line 689 1-29.

NOTE: Invalid data for lvedvi in line 689 36-55.

NOTE: Invalid data for lvesvi in line 689 58-62.

NOTE: Invalid data for rvedvi in line 689 163-178.

Ask a Question
Discussion stats
  • 1 reply
  • 269 views
  • 1 like
  • 2 in conversation