BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Shailesh_R_T
Calcite | Level 5

data SRT;
input ProjID $ Manager :$15. Budget CompletionPercent;
datalines;
P001 James Lee 100000 85
P002 Sophia Ray 120000 90
P003 Michael Chen 75
P004 Emma Stone 95000 .
P005 Olivia Park 110000 88
;
run;

proc print data=SRT;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Thanks. I do believe you.

 

Looks like the OP has vanished.

--
Paige Miller

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

I have fixed a few things here, perhaps this is all of the things that are wrong, or perhaps not, you didn't really tell us what is wrong, and you SHOULD tell us what is wrong.

 

data SRT;
infile datalines dlmstr='~' truncover;
input ProjID $ Manager :$15. Budget CompletionPercent;
datalines;
P001~James Lee~100000~85
P002~Sophia Ray~120000~90
P003~Michael Chen~75
P004~Emma Stone~95000~.
P005~Olivia Park~110000~88
;

 

SAS doesn't really know what separates the fields in your data, the default is a space, but that won't work because the field MANAGER must contain a space. So in this example, I have forced the character ~ to be used as the separator between the fields.

--
Paige Miller
Ksharp
Super User

I think you should post your code or data with this button:

Ksharp_0-1745197502914.png

 

Otherwise it would eat your multiple blanks, like there are four blanks in your data,but display it only one blank.

data SRT;
input ProjID $ Manager & $15. Budget CompletionPercent;
datalines;
P001 James Lee      100000 85
P002 Sophia Ray     120000 90
P003 Michael Chen   75
P004 Emma Stone     95000 .
P005 Olivia Park    110000 88
;
run;

proc print data=SRT;
run;

Ksharp_1-1745197687024.png

 

PaigeMiller
Diamond | Level 26

@Ksharp  Good point!

 

But how did you know 4 blanks were compressed into 1?

--
Paige Miller
Ksharp
Super User
@PaigeMiller
I tried it before. One time I posted the data step without the running man icon, I found multiple blanks compressed into 1.
If you don't believe it, you could try it.
PaigeMiller
Diamond | Level 26

Thanks. I do believe you.

 

Looks like the OP has vanished.

--
Paige Miller

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 979 views
  • 1 like
  • 3 in conversation