Importing issue

Accepted Solution Solved
Reply
Super Contributor
Posts: 371
Accepted Solution

Importing issue

[ Edited ]

Hi Everyone,

 

I am importing the attached file into SAS.

All the Date Time are correctly imported.

Somehow, Sas cannot import number.

It skips records of data as well, say the tradetime of 8:00:00 , 16:00:00 and 0:00:00. 

 

Could you please help me to correct my code below?

Thank you so much for your help.

 

HHC

 


data mt4;
infile "\book3.txt" firstobs=2
dsd dlm=';' ;
informat date yymmdd10. tradetime time11. ;
input Rate $ TimeFrame $ date tradetime Open Close High Low
adx_main adx_plus adx_minus cci ma50 ma15 ma5 ma25 sar stddev atr demarker force macd_5_15 macd_5_50 macd_15_50 macd_long_main macd_long_signal
macd_medium_main macd_medium_signal macd_short_main macd_short_signal rsi_short rsi_long sto_long_fast sto_long_slow sto_short_fast sto_short_slow mfi_14 mfi_24
fractal_up fractal_down Bband130_main Bband130_upper1 Bband130_lower1 Bband130_upper2 Bband130_lower2 Bband130_upper3 Bband130_lower3
;
format date date9. tradetime time8. ;
run;

 


Accepted Solutions
Solution
‎01-21-2016 06:09 PM
Trusted Advisor
Posts: 1,114

Re: Importing issue

[ Edited ]

You're not using SAS 9.4, are you? Just add the option LRECL=1000 to your INFILE statement and the error should disappear.

 

Edit:

Explanation: The default of LRECL (actually the system option with this name) has been increased from 256 to 32767 in SAS 9.4 (exception: RECFM=F). Your data had record lengths up to 403, so "SAS went to a new line when INPUT statement reached past the end of a line." This message must have appeared in your SAS log, plus notes about "Invalid data" (and probably a "WARNING: Limit set by ERRORS= option reached. ...") as well as notes "LOST CARD" and "One or more lines were truncated."

Moreover, your dataset would have contained only 52 observations instead of 105, right? In fact, all observations with TRADETIME 0:00, 8:00 and 16:00 were lost due to the errors.

 

View solution in original post


All Replies
Solution
‎01-21-2016 06:09 PM
Trusted Advisor
Posts: 1,114

Re: Importing issue

[ Edited ]

You're not using SAS 9.4, are you? Just add the option LRECL=1000 to your INFILE statement and the error should disappear.

 

Edit:

Explanation: The default of LRECL (actually the system option with this name) has been increased from 256 to 32767 in SAS 9.4 (exception: RECFM=F). Your data had record lengths up to 403, so "SAS went to a new line when INPUT statement reached past the end of a line." This message must have appeared in your SAS log, plus notes about "Invalid data" (and probably a "WARNING: Limit set by ERRORS= option reached. ...") as well as notes "LOST CARD" and "One or more lines were truncated."

Moreover, your dataset would have contained only 52 observations instead of 105, right? In fact, all observations with TRADETIME 0:00, 8:00 and 16:00 were lost due to the errors.

 

Super Contributor
Posts: 371

Re: Importing issue

Thank you so much.
You are right, I use 9.3.
HHC
☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 468 views
  • 0 likes
  • 2 in conversation