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

Alicia Grossman,13,C,10-28-2008,7.8,6.5,7.2,8.0,7.9

Matthew Lee,9,D,10-30-2008,6.5,5.9,6.8,6.0,8.1

Elizabeth Garcia,10,C,10-29-2008,8.9,7.9,8.5,9.0,

,6,D,10-30-2008,6.7,5.6,4.9,5.2,6.1

Jose Martinez,7,D,10-31-2008,8.9,,10.0,9.7,9.0

Brian Williams,11,C,10-29-2008,7.8,8.4,8.5,7.9,8.0

 

Have to read this in with infile cannot get the right combination of options to deal with missing values, comma delimited, embedded blanks for name, length statement or informat for name .  Tried as many combinations as I could come up with. here is most recent attempt.


DATA Pumkins2;
infile pumpkins DLM= ',';
input Name & $16. Age 2. Type $ EnterDate mmddyy10. j1-j5;
format EnterDate mmddyy10.;
RUN;
PROC PRINT;
RUN;
title;

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

When using delimiters, such as commas, don't try to give SAS instructions about how many characters to read.  Instead, set a maximum length and let SAS figure out which characters to read.  For example:

 

data test;

infile pumpkins dsd;

length name $ 16;

informat EnterDate mmddyy10.;

input Name Age Type $ EnterDate j1-j5;

format EnterDate mmddyy10.;

run;

View solution in original post

1 REPLY 1
Astounding
PROC Star

When using delimiters, such as commas, don't try to give SAS instructions about how many characters to read.  Instead, set a maximum length and let SAS figure out which characters to read.  For example:

 

data test;

infile pumpkins dsd;

length name $ 16;

informat EnterDate mmddyy10.;

input Name Age Type $ EnterDate j1-j5;

format EnterDate mmddyy10.;

run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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