BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hhchenfx
Barite | Level 11

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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

2 REPLIES 2
FreelanceReinh
Jade | Level 19

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.

 

hhchenfx
Barite | Level 11
Thank you so much.
You are right, I use 9.3.
HHC

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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