BookmarkSubscribeRSS Feed
er_awasthi
Calcite | Level 5
Hi,
In chapter 18 of SAS certi book(List Input ) says that ampersand (&) is used to read character values that contains embedded blanks.

For Below program , In value of city(2nd row) there is space between New and Delhi and I'm reading this value without giving '&' and it is being read correctly.
How is this possible ?

DATA INPUT;
INFILE DATALINES MISSOVER DLM=',*' DSD;
LENGTH CITY $9.
JOB $10.;
INPUT FNAME $
LNAME $
AGE
CITY
JOB $;
PUT _ALL_;
DATALINES;
MANISH,AWASTHI*24*PUNE,SFTWR
VIVEK,CHOPRA,*NEW DELHI,CONSULTANT
:


PROC PRINT DATA=INPUT NOOBS;

Output
CITY JOB FNAME LNAME AGE

PUNE SFTWR MANISH AWASTHI 24
NEW DELHI CONSULTANT VIVEK CHOPRA .

.
Thanx

Manish
3 REPLIES 3
DanielSantos
Barite | Level 11
Hello.

That's because you are using the DLM=',*' option.

Everything gets separated by the delimiters (, or *) rather than by blanks.

See more on this here:
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001066690.htm

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You have altered the SAS-default DLM= which would be a blank character.

Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Sorry - missed Daniel's fine reply.

Scott

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
  • 3 replies
  • 642 views
  • 0 likes
  • 3 in conversation