BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have text data delimited by comma as below

240,W,Ginger,,120
240,W,Protea,,180
356,W,Heliconia,,60


DATA A;
INFILE "d:\sas_data\data\testfile.csv" dlm = ',' missover ;
INPUT VAR1 VAR2 $ VAR3 $ VAR4 VAR5;
RUN;

result
240 W Ginger 120 .
240 W Protea 180 .
356 W Heliconi 60 .

the problem is sas doesn't read the 4th field (,,) between Ginger and 120
if i want to sas read it (not skip) and sas doesnt go to the new line when it is end of each record (after 120 it shoud go to new line), how can i do ?
thank in advance
1 REPLY 1
msg
Calcite | Level 5 msg
Calcite | Level 5
Hi,

I assume that you want your program to read the 4th field.

Since your data has two delimiters side by side, you need to introduce sensitivity to the program.

Introducing "DSD" will read that "missing" field.

== Start of code==;
data one;
input num1 text1 $ text2 $ text3 $ num2;
infile cards dsd dlm=',';
cards;
240,W,Ginger,,120
240,W,Protea,,180
356,W,Heliconia,,60
;
run;

proc print;
run;
== End of code==;


Thanks...

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 627 views
  • 0 likes
  • 2 in conversation