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

I can see nothing in the image you posted other than a photo of your screen showing a dataset with nothing in it.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I have manually typed in this information:

 

data ans2;
  input id present total;
  ratio=floor(total/present);
datalines;
54734 25000 85000
55742 7000 65000
;
run;

Which works perfectly for me results in a dataset called ans2:

 

id        present  total     ratio

54734  25000    85000  3
55742  7000      65000  9

 

Please explain what you are doing exactly, start by using the code window {i} above your post to put actual text code in rather than pictures which we then have to manually tpye in.

 

Anil9
Fluorite | Level 6

Yes i agree it runs well when it is few rows (I.e 10 - 30 ) i have entered more than 13000.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Then its likely that it is your data.  Look at the first time you get a value you don't expect, and look at the data.  Judging from the picture you posted, there are observations which don't have any data at all, maybe the import process creating a few blanks rows, or perhaps your CSV is corrupt in some way.  Its something to do with the data anyways as the logic will happily apply the same to each data row.  

Anil9
Fluorite | Level 6

Thanks a lot for helping me, I will find out where the error is.

ballardw
Super User

Note that if your CSV came from an application like EXCEL that rows at the bottom of a file may well consist of something like this:

,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,

,,,,,,,,,,,,,,,,,,,,

 

This is a pretty well know problem with manually edited Excel sheets. So look at your CSV file in a TEXT viewing program like Wordpad or Notepad or even the SAS editor. Go to the end of the file. See if you have such. Delete those rows if present and re-read (or import).

 

Similar things may happen if your header row has one or more blank lines before the actual data.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 21 replies
  • 16745 views
  • 5 likes
  • 5 in conversation