BookmarkSubscribeRSS Feed
Thuetten
Calcite | Level 5

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!

4 REPLIES 4
PGStats
Opal | Level 21

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

PG

PG
ballardw
Super User

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.

Thuetten
Calcite | Level 5

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?

Astounding
PROC Star

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 935 views
  • 6 likes
  • 4 in conversation