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
;
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.
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
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.
Ready to level-up your skills? Choose your own adventure.