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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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