Hello Experts,
Could you please explain the below code as I am not able to understand the kind of output its giving.
data temp;
format length width height 6.2;
array dimms lenght width height;
do j=1 to 10;
length = 100;
width = 50;
height = 30;
do i = 1 to 3;
dimms [i] = dimms[i] + normal (0)*2;
end;
output;
end;
In the below output, why i am getting 2 "lenght" variable? What is the use of "normal (0)*2"?
Why only first Lenght variable getting all 100s for all 10 observations however the other variables "width" and "height" are getting calculated values?
Thanks
The variable named LENGHT is probably a mis-spelling of LENGTH, and this improperly spelled variable appears in your code. This mis-spelled variable has never been assigned a value so you see it is always missing.
NORMAL(0)*2 is a random number generator, multiplied by 2.
LENGTH always has a value of 100 because nowhere in the code does the value get changed, probably because of the mis-spelling that I mentioned.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.