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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 399 views
  • 0 likes
  • 3 in conversation