Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Simulation data using SAS

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-17-2018 02:25 PM
(1787 views)

How do I code my sas prog. to solve this problem?

I trying to comparing correlated means in the presence of incomplete data (Task) using simulated data

I've tried to perform this task using simulated date - statistical power cal.

Compute the empirical size and power calculation using 1000 data sets and significance level of α = 0:05. Under the alternative hypotheses is varied among 0 and 1.0, and the correlation is varied among ρ = 0.2 and 0.9.

- Simulation1

Generate from Exponential distribution with scale parameter = 1; using np = 20, nux = 10, and nuy = 25

- Simulation 2

Generate from normal distribution using np = 20, nux = 30, and nuy = 10

- Simulation 3

Generate from normal distribution using np = 10, nux = 15, and nuy = 5

Where **np** represent the number of complete pairs where both observations (x; y) are present, nux is the number of unpaired observations where only the first value (x) is present

and nuy is the number of unpaired observations where only the second value (y) is present.

Figure 4 – Two Correlated Normally Distributed Variables

Data Example4;

call streaminit(5678);

keep x y;

mu1=10; mu2=20; var1=4; var2=9; rho=.5;

do i = 1 to 1000;

x = rand("Normal", 0,1);

y = rho*x+sqrt(1-rho**2)*rand("Normal",0,1);

x = mu1 + sqrt(var1)*x;

y = mu2 + sqrt(var2)*y;

output;

end;

run

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

*How do I code my sas prog.* to get an answer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks, Need to know how to set up sas code to simulate dat

Compute the empirical size and power calculation using 1000 data sets and significance level of α = 0:05. Under the alternative hypotheses is varied among 0 and 1.0, and the correlation is varied among ρ = 0.2 and 0.9.

Simulation1

Generate from Exponential distribution with scale parameter = 1; using np = 20, nux = 10, and nuy = 25

Where np represent the number of complete pairs where both observations (x; y) are present, nux is the number of unpaired observations where only the first value (x) is present

and nuy is the number of unpaired observations where only the second value (y) is present

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It sounds like you are looking for resources and sample code. Rather than answer your specific questions, here are some links that you might find useful:

Start by reading "Simulation in SAS: The slow way or the BY way" to learn the general structure of simulation code.

To learn how to simulate multivariate normal data in SAS, see "Sampling from the multivariate normal distribution" and "How to generate multiple samples from the multivariate normal distribution in SAS". If you don't have SAS/IML, you can use PROC SIMNORMAL. For 2-D data or for nonnormal data, you can use the DATA step, as you are doing in your post.

For power estimation using simulation, see "Using simulation to estimate the power of a statistical test."

For more information, see "Ten Tips for Simulating Data with SAS", which includes an example of using simulations to estimate power. For many more examples and details, see *Simulating Data with SAS*.

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.