Help using Base SAS procedures

SAS Generating missing values

Reply
New Contributor
Posts: 2

SAS Generating missing values

Hello,

I have two arrays- call them probx and conditional- each with 31 elements. I've ran the program and verified that they all do exist, some are just very small. I have created a do loop to multiply these together and store in an array called num:

do i=1 to 31;

num{i}= conditional{i}*probx{i};

end;

but no matter what I do this returns a missing value for each element. I've tried setting a single variable equal to conditional1*probx1 and got the same result. The only thing I could see which may make a difference is the conditional array has 6 observations, but I've tried restricting it to only one observation and still got missing values. I'm fairly new at SAS and so this could be something dumb I'm doing and just don't know it. Any help would be appreciated. Thanks!

Respected Advisor
Posts: 4,651

Re: SAS Generating missing values

How do you bring these arrays into your datastep? How are the arrays defined? Please post the whole datastep.

PG

PG
Super User
Posts: 10,500

Re: SAS Generating missing values

And verify that ALL variables in the conditional and probx arrays are actually numeric, not character that look like numbers. (Though SAS Usually handles those with warnings you may have something else).

When you say "very small" how small? Any thing that results in numbers smaller than 1E-13 is exceeding SAS precision.

With the conditional array missing for all except 6 observations then the result will be missing for all except those six observations.

New Contributor
Posts: 2

Re: SAS Generating missing values

So I think I somewhat figured it out. To generate the conditional array I had two do loops, one from 1 to 6 to get the observations, and one from 1-31 to do the elements with an output statement in between. As soon as I removed the output statement, it worked. But even if I changed the first do loop from 1 to 1 so it only has one observation, but left the output statement there, it wouldn't work. So does the output do something to prohibit this from working?

Super User
Posts: 5,085

Re: SAS Generating missing values

In a DATA step, OUTPUT means "output right now, before doing any further work" ... so it sounds possible that you are outputting first, and assigning values afterwards.

Ask a Question
Discussion stats
  • 4 replies
  • 270 views
  • 6 likes
  • 4 in conversation