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

Hi,

I'm trying to read a CSV with long records using "infile" statement. I can read the long record using "lrecl=" option. However, this file also has numeric values enclosed within parenthesis, which is giving me an error. I'm using the informat "comma". Can you please advise me how I can fix this? Thank you in advance!

Code:

data input_data;

    infile "&out_path./&fn." dlm="," dsd missover pad firstobs=2 obs=5 lrecl=5640;

    input

          CUSIP :$9.

          Yield_1 - Yield_912 :comma10.3

          dummy :$1;

     drop dummy;

run;

Observation value causing error:

0.670 , (5.095), 3.168

(Note, as the record is very long, I've only listed the values 323, 324 and 325. 323 and 325 are ready correctly)


Log:

NOTE: Invalid data for Yield_324 in line 5 1890-1897.

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Try

(Yield_1 - Yield_912) (:comma10.)


instead. Without the parentheses, the comma. format applies only to the last variable in the list.


PG

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

Try

(Yield_1 - Yield_912) (:comma10.)


instead. Without the parentheses, the comma. format applies only to the last variable in the list.


PG

PG
asimraja
Fluorite | Level 6

PG,

Thank you for help! It worked. Smiley Happy

Asim

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2241 views
  • 1 like
  • 2 in conversation