BookmarkSubscribeRSS Feed
Joseph2020
Calcite | Level 5

After I run the code, I found that there is a format shift in Jorgensen and Robinson, while the other data does not have such problem. May I know the reason why? Thank you.

 

DATA grades;
input Name &$9. Gender: $1. Section: $3. ExamGrade1 @@;
Datalines;
Jones       F Mon   39    Jorgensen   M Mon 63
Judson     F Fri      89    Kuhn           F  Mon 89
LeBlanc    F Fri      70    Lee             M Fri    48
Litowski    M Fri     85    Malloy         M Wed 79
Meyer       F Fri     85    Nichols        M Mon 58
Oliver       F Mon   41    Park            F Mon  77
Patel        M Wed  73    Randleman F Wed  46
Robinson M Fri     64    Shien           M Wed 55
Simonson M Wed 62    Smith N       M Wed 71
Smith R    M Mon  79    Sullivan       M Fri    77

;

 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

The & indicates SAS will continue reading the field until two (or more) blanks appear consecutively.

 

Randleman has only one blank after the name. So you need to be sure that each name has two blanks after it.

--
Paige Miller
ballardw
Super User

You should post code on this forum into a code box opened with either the </> or "running man" icon. The main message windows will reformat text, often removing white space or inserting/replacing characters with html tags.

You may want to look very closely at your post and see if the code actually looks as it did in your editor.

 

Then copy the code from the post, paste into your editor and see if you get exactly the same results

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 698 views
  • 0 likes
  • 3 in conversation