Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi everyone, I need help translating a SAS code and converting it into an R code

ID: 646513 • Letter: H

Question

Hi everyone, I need help translating a SAS code and converting it into an R code.

I'm completely new to SAS and am working with the following code:

data test;

     do i = 1 to 1000;

           x = ranuni(12345);

           output;

     end;

run;

ods graphics on;

proc univariate data=test;

     var x;

     histogram x;

run;

ods graphics off;

I believe this code is supposed to generate random uniform numbers but I cannot understand what each part of the code means. For instance, in x = ranuni(12345), what is the purpose of the seed 12345. Why can't it be written 678910? Also, what is the uniform distribution that this code generates? Is it from 0 to 1 or is it otherwise? Thank you!

Explanation / Answer

In the Program above it is written ranuni(12345)

it is the random uniform number function and given the value 12345.

it is not compulsory to use the number which written there you can change the number as you wish.

it will generate the histogram and graphics it is from 1 to 1000.

Than You.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote