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

lost_value.png

Hello, in screen shot you can see that a value under "sex" column is missing, I have no idea what happened here, only I know is that "10240" is causing it. How to manage with that? I would like to get "10240" value under "type" column, and value "1" under "sex" column, the rest of rows should not change.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

image.png

There is nothing in column 6 on the first line so SEX is read as missing.

You can fix the line by removing the space in column 5 and then SEX and the following values will be read right.  But you would need to read TYPE from column one thru five instead of one thru four.

 

Since your data is separated by spaces just use list mode input instead of column mode.

If you do have any missing values on a line then use a period to represent them so the list mode sees at least something to read for that field in the line and does get out of sync.  Use a period for either numeric or character variables. The normal informat for character variables will translate a single period into blank (missing) value.

View solution in original post

2 REPLIES 2
japelin
Rhodochrosite | Level 12
Try the following instead of the current input statement.

input type sex weight height;

You have specified 1-4 for type, but the next sex fails to read because the value is 5 digits.



Tom
Super User Tom
Super User

image.png

There is nothing in column 6 on the first line so SEX is read as missing.

You can fix the line by removing the space in column 5 and then SEX and the following values will be read right.  But you would need to read TYPE from column one thru five instead of one thru four.

 

Since your data is separated by spaces just use list mode input instead of column mode.

If you do have any missing values on a line then use a period to represent them so the list mode sees at least something to read for that field in the line and does get out of sync.  Use a period for either numeric or character variables. The normal informat for character variables will translate a single period into blank (missing) value.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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